M Sach
M Sach

Reputation: 34424

How to extract the session object from a session id?

In a servlet , I can get the session associated with one browser from httpRequest. I have one more sessionId say ID2(associated with another browser) in this request.

My question is how I can get the session object associated with ID2 from the same request?

Basically I want to extract the session object from a session id. As per my understanding here should be session map stored some where in server which I can use here?

The need for one more session id in request is a different story which I don't want to mention here, to avoid confusion.

Upvotes: 2

Views: 407

Answers (1)

NiranjanBhat
NiranjanBhat

Reputation: 1832

If you are using pure servlets without any other technologies like the JSF or Struts, AFAIK there is no direct method you can get the sessions created. I would recommend you to implement the sessionListener and maintain a list of sessions yourself.

Upvotes: 3

Related Questions