Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access session from different context?  RSS feed

 
devikumar donthamsetti
Greenhorn
Posts: 4
Java PHP
  • Mark post as helpful
  • send pies
  • 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?
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!