6

Is it possible for the session data of one war file to be shared by other war file

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Nrusingha
  • 853
  • 5
  • 19
  • 33
  • I just realized I answered this question to you a few hours ago.. You can edit your questions, no need to create new ones. – Bozho Mar 19 '10 at 20:33

3 Answers3

3

To the point, you just need to configure the server somehow to store the session in a cookie without a path. In case of Tomcat, you can just set emptySessionPath attribute of the <Connector> element to true in /conf/server.xml. Also see this Tomcat Configuration Reference.

<Connector ... emptySessionPath="true">

This however affects all webbaps deployed on the same server.

Update: as you are actually using Websphere (which uses Tomcat under the hoods), you need to alter the Tomcat connector in Websphere's config.xml to include the following attribute:

<attribute name="emptySessionPath">true</attribute>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I am using websphere. the reason I want to do it is to share login information across multiple web application – Nrusingha Mar 19 '10 at 15:35
2

Its not easy to do. but I have been able to do this using tomcat. Here is a link http://www.fwd.at/tomcat/sharing-session-data-howto.html I'm not sure what server you are using though. Also, why do you need to do this, there may another solution depending on what you need to do.

John Kane
  • 4,383
  • 1
  • 24
  • 42
  • I am using websphere. the reason I want to do it is to share login information across multiple web application – Nrusingha Mar 19 '10 at 15:24
  • 2
    An easier way (and probably safer) would be to store the information you need in a database that all webapps could reference – John Kane Mar 19 '10 at 20:36
1

Tomcat has the Signle-Sign-On Valve:

The Single Sign On Vale is utilized when you wish to give users the ability to sign on to any one of the web applications associated with your virtual host, and then have their identity recognized by all other web applications on the same virtual host.

You may also try to implement single-sign-on using cookies (though this has security drawbacks).

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140