Re: Webobjects, Flex and Sessions
Re: Webobjects, Flex and Sessions
- Subject: Re: Webobjects, Flex and Sessions
- From: David LeBer <email@hidden>
- Date: Mon, 10 Mar 2008 17:32:01 -0400
On 10-Mar-08, at 3:29 PM, Lachlan Deck wrote:
On 11/03/2008, at 1:43 AM, David LeBer wrote:
On 10-Mar-08, at 10:30 AM, Thierry Kramis wrote:
my understanding is, that you can access a direct action with out
a session id. so basically if i work with session ids i would need
to check if a session id is valid?
If you provide a session id to the DA, WO will try and restore that
session for you. By default, if there is no matching session it
returns the "session expired" page.
This is not true for Direct Actions AFAIK. @see
WODirectAction#existingSession or WODirectAction#session.
Also see WODirectAction class doc which states:
"To handle stale session IDs (e.g. session IDs stored in cookies,
and those session IDs refer to expired sessions), make sure to do
the following at the beginning of your direct action method:"
public WOActionResults myAction() {
if ( getSessionIDForRequest(request()) != null &&
existingSession() == null ) {
// special behavior, like a returning a login page, e.g.
return pageWithName("LoginPage");
} else {
// whatever else you'd normally do here
}
}
You are absolutely right Lachlan. My mistake (I don't even drink
coffee, so I can't blame the lack of that...)
In a DA if you ask for a session with a session ID that doesn't exist,
it'll create a new one for you.
Lachlan's code above avoids that.
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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