• 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
Re: [Solution] Restoring Session when someone leaves the application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Solution] Restoring Session when someone leaves the application


  • Subject: Re: [Solution] Restoring Session when someone leaves the application
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 06 Oct 2004 14:59:04 -0700

Something else must be going on in your app.  I make extensive use of such
direct actions and store the session ID in cookies.  It works flawlessly.


Chuck

At 03:53 PM 06/10/2004 -0600, Gerald Hanks wrote:
>What we found was that setting setStoresIDsInURLs(false) and
>setStoresIDsInCookies(true) only partially worked and it depended on
>what type of action a user took to get back into the application.
>Often times there are direct action links that get used to enter an
>application at different points such as .../wa/login.  These direct
>action entry points almost always created a new session regardless of
>whether or not there was a session id stored in a cookie.  This was
>simply a way for us to get around the new session being created for
>these direct actions entry points.
>
>--gerald
>
>On Oct 6, 2004, at 8:25 AM, Chuck Hill wrote:
>
>> Isn't this the same as adding this to the Session constructor:
>>
>> // We use cookies to store session and instance number.
>> setStoresIDsInURLs(false);
>> setStoresIDsInCookies(true);
>>
>> Chuck
>>
>> At 03:16 AM 06/10/2004 -0600, Gerald Hanks wrote:
>>>>>>
>> 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:
>> village
>> .net
>>
>> This email sent to email@hidden<<<<
>>
>>
>> --
>>
>> Chuck Hill                                 email@hidden
>> Global Village Consulting Inc.
>> http://www.global-village.net
>
>

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
 _______________________________________________
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

References: 
 >Re: [Solution] Restoring Session when someone leaves the application (From: Chuck Hill <email@hidden>)
 >Re: [Solution] Restoring Session when someone leaves the application (From: Gerald Hanks <email@hidden>)

  • Prev by Date: Re: [Solution] Restoring Session when someone leaves the application
  • Next by Date: Re: Question about java method calling
  • Previous by thread: Re: [Solution] Restoring Session when someone leaves the application
  • Next by thread: EOCheapCopyMutableArray
  • Index(es):
    • Date
    • Thread