The contents of the thread storage are removed at the end of each R-R loop to 
prevent data leaking between requests (and to prevent memory leaks too).

Wonder already puts the session in thread storage under “session” so you could 
just use that and ask it for the region in your EOs.


Chuck


From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Benjamin Steiner <[email protected]<mailto:[email protected]>>
Date: Wednesday, December 16, 2015 at 1:07 AM
To: WebObjects-Dev 
<[email protected]<mailto:[email protected]>>
Subject: Using ERXThreadStorage

Hi list,

In our application, we keep the business-logic with the EO-model in a separate 
framework. Because some of the enterprise objects are region-specific, we need 
to get access to the logged in user(or its region, respectively) with a static 
method. The problem is that the user is stored in the session, so we can’t 
access it from the business-framework.

We tried to use ERXThreadStorage, but we only get NULL out of it when we try to 
get the region. Is there something we overlooked?
Here’s the code we use to store and retrieve the region:

(this happens in the constructor of the session, wenn the user logs in)
ERXThreadStorage.takeValueForKey( region, ERXThreadStorageKeys.CURRENT_REGION );

(this happens on an EO in the business-framework)
Region region = (Region)ERXThreadStorage.valueForKey( 
ERXThreadStorageKeys.CURRENT_REGION );

Thanks,
Beni
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to