wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to get a HttpSession from a Session ID ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get a HttpSession from a Session ID ?" Watch "How to get a HttpSession from a Session ID ?" New topic

How to get a HttpSession from a Session ID ?

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
I have a user's session ID stored in a bean. I want to be able to get the actual HttpSession object that this identifies, in order to invalidate it. Is there a way, besides using HttpSessionContext.getSession(), which is deprecated ?

Thanks in advance...

Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
As docs says HttpSessionContext.getSession() is Deprecated with no replacement.

Infact the Id you get from the method getId() is not reliable. As docs says, Id is assigned by the servlet container and is implementation dependent.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

I use a session listener to store a reference to the session in a HashMap that lives in a singleton object.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link: http://aspose.com/file-tools
subject: How to get a HttpSession from a Session ID ?
Similar Threads
Getting HTTP Session by using Session ID
Get session object from session ID
wich session tracking techniwue to use
Why cann��t get the original session object in second Servlet?
Getting HttpSession object from SessionContext