Re: getting a session from WOApplication dispatchRequest
Re: getting a session from WOApplication dispatchRequest
- Subject: Re: getting a session from WOApplication dispatchRequest
- From: Ramsey Gurley <email@hidden>
- Date: Wed, 27 Apr 2011 09:31:55 -0700
Example:
https://github.com/nullterminated/ponder/raw/master/ERAuth/Sources/er/auth/ERStageManager.java
This allows me to maintain a user on the session without the session knowing anything about the user. I just call ERStageManager.INSTANCE.setActor(user) after a successful login and I'm done. (^_^)
Ramsey
On Apr 27, 2011, at 8:32 AM, Mike Schrag wrote:
> wonder posts SessionWillAwakeNotification and SessionWillSleepNotification notifications ... might be the better way to do it. you probably don't want to be doing session stuff in dispatch request ... you can do it, but you have to check out before, checkin, call super, check out, check in or you'll probably get an exception or deadlock when it tries to lock the session twice on the same thread.
>
> ms
>
> On Apr 27, 2011, at 11:21 AM, Michael Gargano wrote:
>
>> Hi all,
>>
>> I need to do something like this...
>>
>> public WOResponse dispatchRequest(WORequest) {
>>
>> session = getWOSession
>>
>> retrieve / modify values in session
>>
>> bind some thread local variables
>>
>> response = super.dispatchRequest()
>>
>> unbind the tread local variables
>>
>> return response
>> }
>>
>> I was trying to get the session from the request's context, but the context has not be created at this point. So, there were two ways I was looking at accomplishing this....
>>
>> 1) call createContextFromRequest() to get a new context followed by restoreSessionWithID
>> (this seems like the dicer of the two options)
>>
>> 2) call sessionStore() to retrieve the session store then call restoreSessionWithID() to get a reference to the session make my reads and changes
>>
>> Chuck had mentioned doing this in Session's awake() and sleep(), but the problem is that I'm trying to unify the WOSession with another framework's session model, so some of the information I need to restore the other session resides in the WOSession. The other framework also has a bunch of stuff it binds to thread local, but everything works off it's own internal utility classes preventing me from using ERXThreadStorage.
>>
>> Thanks.
>> -Mike
>>
>> _______________________________________________
>> 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
_______________________________________________
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