Sharing SessionManager between contexts

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Sharing SessionManager between contexts

Simon Tardell

I have an embedded Jetty 6 where I would like to share session data
between several webapps. The simplest approach would be if there was a
way to declare a set of web apps as "friendly" and automatically get
the same session instance for the same session cookie in each web apps
context. Unfortunately is explicitly forbidden (on presumed "security"
grounds) in the Servlet spec.

Now, I don't have any problems breaking against the spec if it can
help in my programming model. If I actually were to achieve to share
session objects between friendly contexts, are there any actual
problems in doing so? Let's say that I programmatically inject the
same SessionManager into all contexts concerned, would it work as
expected when sessions are serialized, times out or are otherwise
invalidated? Would the session be kept from timing out in all contexts
when being accessed in one? Do the answers depend on the
SessionManager implementation, or is it part of the session manager
contract to do what I want (or not)?

I understand I can achieve the same thing by indexing some external
storage (a db, various enterprise frameworks or some homegrown session
manager that I inject into all contexts as a resource), but I would be
nifty if I could rely on already existing code.


To unsubscribe from this list, please visit: