I need a mechanism to read session state from a Java class, without having to pass any arguments (including HttpRequest) to the class. The reason is that the class is 1-3 calls away from the servlet and i dont want to pollute the method argument list with an extra arg for every call.
I basically have the same prob of these guys:
http://forums.sun.com/thread.jspa?threadID=5124189
For which apparently Java does not have a solution currently..
Cheers
The tempting mechanism is to use ThreadLocal storage, but in some App Servers this is dangerous – the App Server may use pools of Threads and a single request may be processed by different threads at different points.
Some App Servers (I know WebSphere does) offer a specific API for this purpose. In WAS it’s a UserWorkArea. See here for a reference, a little way down the article.
I’m not aware of a portable solution to this problem.