Re: WOComponent.hasSession()
Re: WOComponent.hasSession()
- Subject: Re: WOComponent.hasSession()
- From: Kieran Kelleher <email@hidden>
- Date: Mon, 29 Aug 2005 17:37:33 -0400
Thanks Chuck, restoring the session using existingSession() in
performActionNamed like this worked great without having to touch the
hasSession() dependent logic in WOComponents.
public WOActionResults performActionNamed( String anActionName ) {
// Do we have a session ID in the request URL?
String sessionID = getSessionIDForRequest(request());
if ( log.isDebugEnabled() ) log.debug("Request sessionID = " +
( sessionID == null ? "null" : sessionID ) );
if ( sessionID != null ) {
// Restore the session if possible
WOSession session = existingSession();
if ( log.isDebugEnabled() ) {
if ( session == null ) {
log.debug("Failed to restore session with ID " +
sessionID );
} else {
log.debug("Successfully restored session with ID "
+ sessionID );
}
}
}
return super.performActionNamed( anActionName );
}
On Aug 29, 2005, at 1:21 PM, Chuck Hill wrote:
On Aug 29, 2005, at 10:07 AM, Kieran Kelleher wrote:
I am integrating some direct actions into my app and ensuring I still
handle http/https switching, JIT login, etc. properly.
When I only used component actions, my JIT login depended on
hasSession() method of WOComponent as a prerequisite for checking if
the session had an authenticated user.
What I am finding with diract actions is that although I really have
a session (wosid in the URL), the hasSession() method returns false.
Is that correct behaviour? The WOComponent.hasSession() API does not
seem to indicate. Should I be using some other method to check the
response directly for wosid?
IIRC, what you are seeing is correct / expected behavior. It's Monday.
I've had one cup of coffee. So take this for what's it worth. :-)
If the direct action does not reference session() or existingSession()
then the session is not restored. If the session is not restored then
WOComponent.hasSession() returns false. You could try to use
context().request().existingSession() != null in place of the
hasSession() call, call context().request().existingSession() before
calling hasSession(), or add a call to existingSession in
DirectAction.performAction before calling super.performAction().
Chuck
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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