• 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

How to access session from different context?

 
Greenhorn
Posts: 4
PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to access session from different context?
I have created a session in one jsp, in one context and trying to access it from different context. But, I was unable to access the same. How to achieve it?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cross context calls have to be explicitly allowed. Have you managed to configure your system to allow cross context calls?
Do you get a result from call to servletContext.getContext(...)

The next issue becomes then obtaining a session from the other context.

The API for retrieving sessions by ID was removed for security reasons. You can duplicate that functionality using sessionListeners storing sessions as they get created.
Most probably the solution would require keeping a map of user->session in application scope.

But this is all getting complicated. I would query your base design if you need to jump through hoops like this.
reply
    Bookmark Topic Watch Topic
  • New Topic