aspose file tools*
The moose likes Servlets and the fly likes Sharing sessions between WARs: request from one WAR file to another WAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sharing sessions between WARs: request from one WAR file to another WAR file" Watch "Sharing sessions between WARs: request from one WAR file to another WAR file" New topic
Author

Sharing sessions between WARs: request from one WAR file to another WAR file

Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 59

This is my requirement.

User logs in to an existing application and using it as usual. I have to develop another web application that will an additional module to the existing application. It will be launched by clicking on one link on the existing application.

Now user logs in to the existing application and clicks on the link for this new application. It opens in a new window. But in this new application

request.getSession(false) is returning null. I thought I'll be getting the session from the existing application.

First time the request gets into a Filter(for all url pattern using /* inside my new application) and i check whether the session is null here. If so I'm redirecting it to SessionExpired.jsp.

Next time, when again i launch this new application from that link (without logging in again), the session is not null. I guess it is getting created from SessionExpired.jsp.

Since the login authentication is done by the first existing application I just want to check whether that session exists with the request.

But i am getting null, meaning that i dont have access to the session created by the existing application. How can I manage this situation?
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
Either you manage the login yourself (that is, on the application level circumventing the container-supplied login management) and organize the interaction between the applications to support this, or you might want to look for the enviroment's supporting this. The key word (search criterium) is "single sign-on".
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 59

Thanks for your informative reply. Can you please suggest me how to manage the login sessions by myself inside my application?

Every request to the welcome page comes with a user-id logged in from existing application. How shall I manually create a new session only for this request( the request that launches my application from another application)?

If this created session expires inside my web application then i'll simply close the web page(of my new application) after alerting the user to login into the first application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sharing sessions between WARs: request from one WAR file to another WAR file