There is a really valid technical reason for the servlet spec's constraint
about sessions not being shared across web apps -- each web app is loaded
from a different class loader, so they cannot see each other's bean
classes.  So, even if you hacked Tomcat to allow shared sessions, beans
created in webapp 1 would not be accessible in webapp 2.

The best way to share state information across web apps is to use external
mechanisms (databases, EJBs, etc.) and pass the record key or whatever
through the query string.  To avoid session timeouts while the user is
"gone", one thing you can do is call session.setMaxInactiveInterval() on
the originating session to some very large value when they leave, and set
it back again when they come back.

Craig


On Tue, 24 Jul 2001, Becky Moyer wrote:

> Struts-users!
>    Sorry if this is not the best forum for this; I am asking this here 
> becuase I think Struts factors into my question.
> 
>    I am creating a web site that allows for the future addition of new 
> webapps to extend the original site.  I would like to allow users to make 
> their add on as a full webapp, and I'll store the link to the new webapp in 
> my database.
> 
>    One of the requirements I have is that I need to pass my session onto the 
> new webapp. But, oops, you can't do that.  Tomcat (and the Servlet API) 
> doesn't let you pass a session to a new webapp - as far as I can tell.  I 
> could pass the important tidbits as strings along in the URL and recreate a 
> session once I get to the new webapp, but that has its own set of 
> problems...it's insecure (no matter how i encode the URL), and it completely 
> messes up the first webapp, becuase when I return to that webapp the session 
> will probably have timed out.
> 
>    Does anyone know of a way that I can maintain a list of trusted webapps 
> which I can pass session between?  How about if there is a way to deploy an 
> entire webapp within the context of another?  I don't want future developers 
> to need to mess with my code to get their apps into my context.
> 
>    And here is the STRUTS part of my question.  If I allow future developers 
> to simply put all of their JSPs/images/templates/etc. into a subdirectory in 
> my webapp, is there a way to allow them to either add their own 
> struts-config.xml file or make struts reread the struts-config.xml file 
> while Tomcat is still running?  I also have a requirement of leaving the 
> server running while i deploy so that i don't lose sessions.
> 
>    Any thoughts would be welcome and appreciated.  I have looked through 
> archives for Tomcat and Struts and can't seem to find an answer.
> 
>   Thanks in advance!
>    Becky
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> 

Reply via email to