If I have an EAR containing multiple WARs and set a session variable in one of the WARs, is that var accessible to the other WARs in the EAR? If so, do I have to do anything special to get the value? If not, are cookies the only way to go to acheive this?
- Posted by: M J
- Posted on: July 26 2004 15:34 EDT
- Sharing session variables between web applications by Rene Zanner on July 28 2004 06:33 EDT
- Sharing objects between web applications by M J on July 29 2004 14:00 EDT
- I face the same problem. by Zhidao Xu on August 06 2004 04:29 EDT
- Sharing session variables between web applications by Matt DeC on September 30 2004 12:41 EDT
Sharing session variables between web applications by analog boy on December 22 2004 03:43 EST
Sharing session variables between web applications by Carlos Henrique Duarte on February 04 2005 06:43 EST
- Re: Sharing session variables between web applications by Imran Ali on June 29 2009 06:08 EDT
- Sharing session variables between web applications by Carlos Henrique Duarte on February 04 2005 06:43 EST
- Sharing session variables between web applications by analog boy on December 22 2004 03:43 EST
By design the sessions between different web applications cannot be shared. The JSP specification prohibits that.
If you want to share information between web applications, you have to find a different way. Sorry if that does not help you very much, but since I did not have the necessity to share state between different web applications, I cannot help you with an out-of-the-box solution for that problem.
Maybe it's possible to use an instance on enterprise application level, e.g. a stateful session bean or even a database table - but maybe that's too much overhead.
Why do you need to share state variables between those applications?
Ok, maybe session variables is the wrong term. I have a user object that gets created in one WAR that I need to use in another WAR in the same EAR.
What is the best way (that isn't overly complex) to do this?
I have one EAR(main application, called MA) and one WAR(supporting application, just JIRA).
I want to integrate JIRA with MA, since I want to use JIRA as part of my application MA. User starts from MA and when he want some extra information, he will click the link in MA and then link to JIRA.
But MA has a session expiry checking.
When user works with JIRA, MA should not treat he as idle. If user finally were kidded off by JIRA, the MA will also expire the session of user.
Is there anyone could give me some light about this?
If you are using WebSphere / WSAD you can do it. IBM's non-j2ee compliant way of doing this involves a file called sessionshare.xml. In this file you list the enterprise application names where you want to enable sharing. Google sessionshare.xml for more info.
I got the following documentation on Java Forum. I hope this help.
hmmm we can do this according to J2EE spec but has been implemented in several application servers like WebLogic, WebSphere or JBoss for example. http://tedorgwp.free.fr/?p=163