[jboss-user] [EJB 3.0] - Re: Storing user info on server

ALRubinger do-not-reply at jboss.com
Fri Mar 7 02:00:52 EST 2008


"jwcone" wrote : Is there a client-agnostic equivalent to the HttpSession at the container-level?

Well, no.  For that you'd have to roll your own.

This has actually got me thinking quite a bit. :)

My decision to use a webapp as an example takes for granted encapsulation of a request, and tying this request to a session.  And my little mashup also presupposes your web container is in the same JVM as the JEE app.  These are some bad assumptions to make.

So this makes for a pretty neat exercise: how do we model an application request without respect to the type of client?

I've already addressed the handling of an "Application Session" via a SFSB proxy that's placed in Thread scope for the duration of the request.  What we're now missing is a layer capable of storing that proxy to model a "Client Session", and tying it with an "Invocation Request".

So the responsibilities of this layer would be:

* Maintain a map of Client Sessions
* Translate an Invocation Request into the proper executions
* Register the Application Session with the Thread based on the SFSB stored in the Client Session looked up from something in the payload of the Invocation Request

You could probably build a whole client-centric invocation framework upon this model, to which many implementations could support.  Servlet, Flex, RMI...all become users of this layer which abstracts the client type from the Application itself.

I'm not really giving you answers here, clearly, but you're spinning my gears.

Let's take your GUI.  You could easily store a SFSB proxy to model your session on the client, and invoke *through* it to access other Services.  Problem is, you don't really want to be using a delegate pattern here - any time you add/edit/change a service you'd have to update the SFSB to support that change.  But if the SFSB had a more dynamic "invokeService()" method, you could use that to get to your other services.  And if the SFSB on your client also had within it a reference to another SFSB (your Application Session), then after you call "invokeService" the container could automatically register your Application Session.

Food for thought, if nothing else.

*How do we best implement client-agnostic session handling*?

Thanks for the fodder for next week's blog, anyway.  I'll be thinking more on this.

S,
ALR



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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134748



More information about the jboss-user mailing list