Link to home
Start Free TrialLog in
Avatar of Software Programmer
Software Programmer

asked on

Retrieve and Invalidate Session using session id

We are storing all the HttpRequest session id in the table. Assume 100 users are active in an application.

If i query the table, i will get all the session ids.

1. How to load the corresponding HttpRequestSession using the id ??
2. How to invalidate few session based on the user details ??
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Software Programmer
Software Programmer

ASKER

Yes session ids are stored in the mysql table
mysql table
That is different. You can't put a HttpSession reference in there. I am suggesting you use an application-scoped Hashtable.
When the sessionDestroyed will get executed ?? How to access the session throughout the application which is being set in hashtable so that to make it invalidate ???
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How about using Spring Security Context and get all the principal objects and retrieve the session and invalidate it? Is it safe to use it or right way to invalidate the other user's session in terms of security ?
I don't use Spring.
Please kindly re-route this question to a spring expert for an answer.
You can add the appropriate Spring tag yourself. Go to top and click on tag edit button.
I'm unable to add the spring tag from the beginning. it always throws error - "Please select at least one approved topic."
I guess you should ask a moderator.
Rrz is correct..We can close this question..This has been resolved.