• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Session... when are they created?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Session... when are they created?


  • Subject: Session... when are they created?
  • From: Francesco Romano <email@hidden>
  • Date: Fri, 7 Aug 2009 12:11:14 +0200

Hi...
I've 2 problems with sessions...

1) When are they created? I thought that they are created either when you call the session() method or when you use some component that need a session...
I don't understand why a new session is created calling this page:

<wo:PageWrapper title = "$pageTitle" showMerceologiaMenu = "true">
<div id = "maincontent">
<wo:ERXStyleSheet filename = "products_layout.css" framework = "app" />
<div id = "summary">
<div id = "right_summary">
<p><webobject name = "prezzoString"/></p>
<p><wo:link action = "$addToCart" string = "Aggiungi al carrello"/></p>
</div>
<div id = "left_summary">
<div id = "sum_prod_title">
<p><wo:str value = "$product.nome"/></p>
</div>
<div id = "sum_prod_img">
<wo:img filename = "$product.photoSrc" framework = "app"/>
</div>


<div id = "short_desc">
<p><wo:str value = "$product.smallDesc" escapeHTML = "false"/></p>
<p><a href = "#long_desc">Learn More</a></p>
</div>
<div id="close_summary"></div>
</div>
</div>

<div id = "long_desc">
<p>Descrizione</p>
<p><wo:str value = "$product.descrizione" escapeHTML = "false"/></p>

</div>
</div>
</wo:PageWrapper>

prezzoString: WOString {
value = product.prezzo;
numberformat = "$ 0.00";
}

 The page wrapper should not create a session (I use it in every page, and it not create a session...)

That page is called from this:

productLink: WOHyperlink {
directActionName = "showProduct";
actionClass = "DirectAction";
?product = aProduct.prodID;
}

public WOActionResults showProductAction() {
WOComponent nextPage = pageWithName(ShowProduct.class);
nextPage.takeValueForKey(request().formValueForKey("product"), "product");
return nextPage;
}

 I'm sure that some days ago it worked....


2) Let's say an anonymous user has a session... then he logs in. And... I don't want the session change!!
This is the code (it's a direct action, called from a submit button in a form)

public WOActionResults doLoginAction() {


WOComponent nextPage = null;
EOEditingContext ec = ERXEC.newEditingContext();
String username = (String) request().formValueForKey("username");
String password = (String) request().formValueForKey("password");
Object redirect = request().formValueForKey("redirect");



Cliente user = Cliente.fetchCliente(ec, Cliente.EMAIL.eq(username));
if (user == null) {
//errore.. utente nn trovato;
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("utente non trovato", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (! user.password().equals(password)) {
//errore.. password sbagliata
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("password sbagliata", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (user.activationDate() != 0) {
//errore.. utente non attivo
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("Utente non ancora attivo. Per favore procedi con l'attivazione", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
ERXApplication.log.info(context().hasSession()); // it returns false
user = (Cliente) EOUtilities.localInstanceOfObject(session().defaultEditingContext(), user);
ERXApplication.log.info(context().hasSession()); // it returns true
((Session)session()).setUser(user);
if (redirect.equals("account"))
nextPage = pageWithName(AccountPage.class);
return nextPage;
}

The problem is that it seems he don't have a session..(tested in the context.hasSession()).. but.. this is the log:

Aug 07 12:08:08 PNStore[5100] INFO  er.extensions.appserver.ERXApplication  - Created Session xqBvrhS2xvYiy2k7g00IMg
 ...
Aug 07 12:08:19 PNStore[5100] INFO  er.extensions.appserver.ERXApplication  - false
Aug 07 12:08:19 PNStore[5100] INFO  er.extensions.appserver.ERXApplication  - Created Session tucshimhkohHUgesq7l9nw
Aug 07 12:08:19 PNStore[5100] INFO  er.extensions.appserver.ERXApplication  - true


What is wrong??

Thanks.

Francesco



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Session... when are they created?
      • From: George Domurot <email@hidden>
    • Re: Session... when are they created?
      • From: Mike Schrag <email@hidden>
  • Prev by Date: Re: Many to many relationship... some problem
  • Next by Date: Re: Ant Classpath Problems [Duh. Fixed]
  • Previous by thread: Re: Hey! Where are my thread dumps?
  • Next by thread: Re: Session... when are they created?
  • Index(es):
    • Date
    • Thread