Re: [Solution] Restoring Session when someone leaves the application
Re: [Solution] Restoring Session when someone leaves the application
- Subject: Re: [Solution] Restoring Session when someone leaves the application
- From: David Teran <email@hidden>
- Date: Wed, 6 Oct 2004 12:35:02 +0200
Hi,
take a look at
session().setStoresIDsInCookies(false)
regards David
Am 06.10.2004 um 11:16 schrieb Gerald Hanks:
I am working on a project for a client that needed the ability for users that were using his webobjects application to be able to leave the application and upon return have their active sessions still accessible. One reason to be able to leave the application was to view customer service docs that are stored in static html, another reason was to be able to browse to other websites and not have to use the browser back button to get back into the application. My solution to the problem was to store the users session id in a cookie and then override createSessionForRequest to see if that cookie exists. If the cookie exists then I try to restore the session using that session id, otherwise I create a new session. Here is how I overrode the method. Can anyone see anything inherently wrong with this approach? It seems to be working well and has been in place now for about a month with no problems.
public WOSession createSessionForRequest(WORequest aRequest) {
//NSTimestamp aTime = new NSTimestamp();
WOSession aSession = null;
WOContext aContext = new WOContext(aRequest);
String aSessionID = aRequest.cookieValueForKey("WOSessID");
if((aContext != null) && (aSessionID != null) && (!aSessionID.equals(""))) {
//System.out.println("Attempting to restore session: " + aSessionID + " at: " + aTime);
aSession = (Session) restoreSessionWithID(aSessionID, aContext);
}
if(aSession == null) {
//System.out.println("A new session was created at: " + aTime);
aSession = (Session) super.createSessionForRequest(aRequest);
WeakReference aReference = new WeakReference(aSession);
} else {
//System.out.println("An old session was restored at: " + aTime);
}
return aSession;
} _______________________________________________
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
_______________________________________________
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