A pattern I've traditionally employed revolves around the notion of an 
"Application Session", which is stored in any of your client-specific access 
sessions (ie. Webapp, Flex, GUI).  So the application deals with this alone, 
and is agnostic towards the type of client.

I'll outline for a webapp here as its probably the most widely used, but you 
can apply the techniques however you'd like.

---

* End user makes HTTP Request

* Servlet Filter intercepts before sending along the FilterChain.  Grabbing the 
ApplicationSession, which is an SFSB proxy, from the HttpSession, places in a 
public static ThreadLocal variable before the invocation continues.

* There's now an ApplicationSession bound to this request/Thread's scope, 
usable from any component without having to pass it around or add it to every 
method signature.

* On the way out, Servlet Filter (in a finally block) clears the ThreadLocal 
var holding the SFSB proxy back to intialValue(), otherwise the 
ApplicationSession will remain tied to this Thread, which will be reused in 
other requests.

---

So above the parts bound to the webapp are the HttpSession for storing the SFSB 
and the Filter for placing it in Thread scope.  To support another client type, 
just add the appropriate mechanisms to provide these behaviors.

S,
ALR

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134114#4134114

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134114
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to