aspose file tools*
The moose likes Websphere and the fly likes HttpSession sharing between two apps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "HttpSession sharing between two apps" Watch "HttpSession sharing between two apps" New topic
Author

HttpSession sharing between two apps

Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
Hi

I have two applications (EARS) deployed in websphere, once the user logs into one app he is authorised to access the other app also.

I want to put the user credentials in a session and I want to pass the session to the other app.

how can I approach for this?

how can I share session between two apps?


"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Do the apps run on different domain names or the same domain?
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
They run on same domain.....
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

Dear Madhusudhana E,

Here on JavaRanch, we have a naming policy. We want the users of JavaRanch to use a real name as their display name.

Unfortunately, your name "Madhusudhana E" does not comply to the naming policy. Your name should consist of a first name, space, and second name. A single letter as your second name is not acceptable.

Please take a moment to carefully read the naming policy and change your display name. You can change your name by editing your profile.

Please note that we are taking the naming policy seriously. If you do not change your display name, your account on JavaRanch might be deleted.

You have already been warned multiple times about this, but you still did not change your name. So please change your name immediately.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Sessions aren't meant to be shared across contexts.
There is nothing in the servlet spec for doing this.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
Hi can we share session between two applications which are deployed as war files??
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Madhu",
Please check your private messages.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Madhu:
Hi can we share session between two applications which are deployed as war files??


The manner in which they're packaged has nothing to do with this.
HttpSessions are per context and aren't meant to be shared.
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
I heard that about HttpSessionActivationListner interface

is it for the apps deployed in two different JVMs??
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Madhu Sudhana :
I heard that about HttpSessionActivationListner interface

is it for the apps deployed in two different JVMs??


No, it has nothing to do with multiple JVMs.

There are ways for one context to get access to another context's objects but the methods for doing so aren't clearly defined in the servlet spec.
This means that their implementation varies from one container to another.
If you'd like, tell us what container you're using I can move this thread to the forum for that container.
Maybe someone there will know how such things are done in that container.
[ August 22, 2007: Message edited by: Ben Souther ]
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
I am making use of WebSphere 6.1
Alok Kushwah
Ranch Hand

Joined: Jul 10, 2007
Posts: 31
Hi Madhu,

It is not possible to share session between two unrelated applications.

If I am getting it right, this is the case of SSO (Single Sign On). You want to make user authenticated by one application, able to use other application without providing credential once again. Sign on one time and use all the application seamlessly without signing on once again.

Here two (more) applications are trying to share data (authentication in this case). There are some framework available to like CA's SiteMinder SSO (http://ca.com/us/products/product.aspx?ID=5480).

You can implement your own SSO using different techniques. Like revers proxy, in which authentication server intercepts all user request and redirect it to cooperating applications. Application share data using cookie /common DB.

Regards
Alok Singh Kushwah
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
EDIT | I should learn to read :roll:
[ August 22, 2007: Message edited by: Chris Corbyn ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
WebSphere Application Server provides a means for single sign-on. See this link for details.


Merrill
Consultant, Sima Solutions
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
please go through the link.......it specifies how can we share session between two webmodules of enterprise app in websphere......click here
[ August 27, 2007: Message edited by: Madhu Sudhana ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSession sharing between two apps
 
Similar Threads
Inheritance in EJB
Maintain request object across multiple servers/web apps
Sharing Session between Two WAR Files
How to integrate two web applications having two different context paths
Sharing session across servlet context