aspose file tools*
The moose likes Servlets and the fly likes Getting another context (or Sharing session between contexts) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting another context (or Sharing session between contexts)" Watch "Getting another context (or Sharing session between contexts)" New topic
Author

Getting another context (or Sharing session between contexts)

Maerch Skirsen
Greenhorn

Joined: Aug 14, 2008
Posts: 2
Heyja,

I want to use more than one WebApplications because of modularity. The problem is, that i need to migrate the sessions between them. I found a promising howto at this site, which (short explanation) stores a map as an attribute in a context of an app. In this map the key is the session id and the value the session.
Now i start to play with contexts and try the following example (i tried Tomcat 5.5 and 6.0 as well):

My first app, called FirstApp and stored as /webapps/FirstApp/index.jsp


My second app, like my first, but as /webapps/SecondApp/index.jsp


Unfortunately the context is always null. I found several sites like this that explain that i have to activate this feature for tomcat.
So i tried to add ...


in /config/context.xml and in /config/server.xml but nothing leads to success. So i am not sure if this is a Tomcat issue. Maybe its more my own code. What do you think? Or is there maybe another and better way to solve my issue as through contexts.

Thank you in advance
Maerch
Maerch Skirsen
Greenhorn

Joined: Aug 14, 2008
Posts: 2
OK, i found a way which works on Tomcat 6.0.

Create a file context.xml with the following content



and put it in the META-INF folder. After a Tomcat restart it should work. With this you can easily share sessions between contexts like on the side above is described. Have fun. I will have. :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting another context (or Sharing session between contexts)