I have a problem. I hope somebody can help me.
I want create UserContext when Servlet HttpListener SessionInitialize Method running. And after i want to call UserContext in Java Class.
Example :
protected static Map userMap开发者_运维技巧List=new HashMap();
this Map keep my application users contexts.
But i don't know how can i achieve active(current) UserContext in some classes?
Other Example in JSF:
FacesContext Thanks,
use ThreadLocal class to store thread specific values. so when you get the new request [which really a new thread], you can dump that in the ThreadLocal object after that, any class running on the same thread can just call ThreadLocal.get.
check its api @ http://download.oracle.com/javase/1.4.2/docs/api/java/lang/ThreadLocal.html
精彩评论