• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session variables across domains

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Mike Cronin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic