Re: WOLongResponsePage and sessions
Re: WOLongResponsePage and sessions
- Subject: Re: WOLongResponsePage and sessions
- From: Pascal Robert <email@hidden>
- Date: Thu, 7 Aug 2008 13:14:23 -0400
Le 08-08-06 à 11:11, Guido Neitzer a écrit :
On 06.08.2008, at 07:20, Pascal Robert wrote:
public Object performAction() throws Exception{
try{
os = new EOObjectStoreCoordinator();
os.lock();
ctx = new EOEditingContext(os);
ctx.lock();
HashMap stats = statistique();
IterationStatistiques np =
(IterationStatistiques
)pageWithName(IterationStatistiques.class.getName());
WOResponse r = np.generateResponse();
return r.contentString();
}
catch(Exception e){
NSLog.out.appendln(e);
throw e;
}
}
It was working fine until I added a WOHyperlink to
"IterationStatistiques". The hyperlink generates a different
session ID, so when I click on the link, I get a session timeout
(which is normal, since the session don't exist anymore). Is there
a way to use the same existing session when performAction is run?
The problem might be, that performAction runs in a different thread
so you might not get the correct context and therefore you are not
creating the correct links with the correct context and session ids.
You should create your page in pageForResult.
Ok, tried that like this :
public Object performAction() {
try{
os = new EOObjectStoreCoordinator();
os.lock();
ctx = new EOEditingContext(os);
ctx.lock();
HashMap stats = statistique();
return stats;
}
catch(Exception e){
NSLog.out.appendln(e);
}
return null;
}
public WOComponent pageForResult( Object resultat ) {
IterationStatistiques np =
(IterationStatistiques
)pageWithName(IterationStatistiques.class.getName());
np.annee = annee;
np.noeud = version.groupeRacine();
np.mapStats = (HashMap)resultat;
WOResponse r = np.generateResponse();
parent.rapportStats = r.contentString();
return parent;
}
But now I get "broken pipe" errors because IterationStatistiques take
too much time to render. I guess I have to move some processing from
IterationStatistiques to something I can call from performAction
without generating any response until pageForResult is called :-/
Also I guess you removed quite some code or is there really no
unlocking going on?
The unlocking is done is the finalize() method.
-------------------------------------------------------
Pascal Robert
http://www.macti.ca
http://www.linkedin.com/in/macti
Skype: MacTICanada
AIM/iChat : MacTICanada
_______________________________________________
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