Re: WOLongResponesePage Problem
Re: WOLongResponesePage Problem
- Subject: Re: WOLongResponesePage Problem
- From: Lachlan Deck <email@hidden>
- Date: Mon, 26 May 2008 13:04:02 +1000
On 25/05/2008, at 7:09 AM, Tonny Staunsbrink wrote:
On Thu, May 22, 2008 at 3:16 AM, Lachlan Deck <email@hidden>
wrote:
On 21/05/2008, at 8:11 PM, Patrick Middleton wrote:
On 21 May 2008, at 10:59, santoshg wrote:
I am using WOLongResponsePage Component in my project.
But in the run time, it is showing the error message:
Session.context() evaluates to null. You may be trying to
get the
context object
from an archived session object. there is no context object
outside of the
request-response loop.
The component is unable to generate response.
I would like to know how to access the Session context in
WOLongResponsePage performAction() method.
Please help in solving the above situation, if possible with
some
code snippet.
Thanks and Regards,
gsk.
You can't, and you shouldn't try.
A request is received and processed and a response is generated,
and this
all happens in one thread, and it needs to be quick. While this is
happening you have access to the Session and the WOContext in that
thread.
What you need to do is get all the properties you need from the
Session or
WOContext before you start the thread that does the long response
thing, and
store them in instance variables in your component, so that when the
secondary thread is running it can use those instead.
Also bear in mind that accessing the session's editing context
within the
performAction thread is a sure path to deadlocks.
Using the sessions editingContext in a background thread with proper
locking/unlocking should be ok I think.
Safer not to. Which session/ec do you think the Long Response page
refreshes with (or not if it's locked)? If you've got a long
computation, it'll never refresh. It's better/safer to pass into your
thread global ids of the objects you want to mangle and fault them
into a new ec.
YMMV :-)
with regards,
--
Lachlan Deck
_______________________________________________
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