| Author |
Session variables across domains
|
Mike Cronin
Greenhorn
Joined: Apr 17, 2002
Posts: 25
|
|
Hi there, I have a servlet in one domain that sets a session variable and displays a link to a servlet in another domain. When the client clicks on the link, I'd like to validate the session variable set in the initiating domain. Is it possible to retrieve session variables across domains? Thanks, Mike
|
 |
Tim Baker
Ranch Hand
Joined: Oct 04, 2003
Posts: 541
|
|
|
i'm not sure what your asking but if you have multiple sites on the same server you can use application level variables between them
|
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
|
 |
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
|
|
if you have multiple sites on the same server you can use application level variables between them Hmm. I think this is unlikely. "different sites on the same server" are almost always implemented as either separate servlet containers attached to a "front door" web server such as apache, or as separate web applications in a single container. Both of these cases will not allow the sharing of application- or sesion- level information. To share anything between separate web applications you usually need to either store the information somewhere that both applications can read from (a database, JNDI, a file etc.), or use a network-based protocol (FTP, HTTP, web services, RMI, ...) to transfer it directly from one application to another.
|
A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
|
 |
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
|
|
OK, what you're referring to is a limitation set in the Servlet Spec that Session scope is limited to an individual web app. Actually, some Application Server vendors (such as WebSphere) provide special configuration switches that relax this constraint, but if you use them, you are now no longer writing a portable application. If that's not a concern to you, and you're using a server with that capability, more power to you. On the other hand, to write something like this in a J2EE-compliant way, I'd suggest you store the "shared" information in something like a shared database, perhaps keyed by a value placed in a cookie. Kyle [ January 01, 2004: Message edited by: Kyle Brown ]
|
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
|
 |
Mike Cronin
Greenhorn
Joined: Apr 17, 2002
Posts: 25
|
|
Hey gang, Thanks for all that input. As of today, I decided to move the apps under the same domain which of course solved this issue all together. Thanks again for your assistance! Mike
|
 |
 |
|
|
subject: Session variables across domains
|
|
|