tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Kwiatek" <Michal.Kwia...@cern.ch>
Subject RE: session state preserved across different applications
Date Fri, 30 Sep 2005 08:16:45 GMT
Thanks a lot Bernhard, this is a pretty complete explanation!

Michał.

> -----Original Message-----
> From: Bernhard Slominski [mailto:bernhard.slominski@zooplus.com] 
> Sent: Thursday, September 29, 2005 6:25 PM
> To: 'Tomcat Users List'
> Subject: AW: session state preserved across different applications
> 
> Hi Michael,
> 
> this comes up every so often, so here is just the answer, 
> which I posted some time ago:
> 
> First of all the session is ALWAYS on application scope, this 
> is not an Tomcat specific behaviour but a requirement of the 
> Specification:
> "SRV.7.3 Session Scope
> HttpSession objects must be scoped at the application (or 
> servlet context) level.
> The underlying mechanism, such as the cookie used to 
> establish the session, can be the same for different 
> contexts, but the object referenced, including the attributes 
> in that object, must never be shared between contexts by the 
> container."
> 
> So there is no way around this, if the sessions were 
> replicated across the applications it would violate the specification.
> 
> When you enable crossConext for your application:
> <Context crossContext="true" docBase="testapp" path="/testapp"
> reloadable="true">
> </Context>
> 
> you can get the context for another application:
> ServletContext context2 = context.getContext("/testapp");
> 
> and set attributes:
> context2.setAttribute("test","JSP is great!");
> 
> But you cannot get to the session in the other application.
> 
> So what you can do is implement the session swapping on your 
> own (Cookies, via the Database) or merge your applications into one.
> 
> Some links from the Sun Forums:
> http://forum.java.sun.com/thread.jsp?forum=33&thread=259394
> http://forum.java.sun.com/thread.jsp?forum=45&thread=492484
> http://forum.java.sun.com/thread.jsp?forum=33&thread=318569
> 
> Cheers Bernhard
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Michal Kwiatek [mailto:Michal.Kwiatek@cern.ch]
> > Gesendet: Donnerstag, 29. September 2005 15:34
> > An: Tomcat Users List
> > Betreff: session state preserved across different applications
> >
> >
> > Dear all,
> >
> > How is it possible to preserve session state across different 
> > applications deployed in tomcat?
> >
> > I'm pretty sure I saw it somewhere, but I can't remember where it 
> > was...
> >
> > Thanks in advance,
> > Michał.
> > 
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message