This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Accessing session of another user 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 "Accessing session of another user" Watch "Accessing session of another user" New topic
Author

Accessing session of another user

sachin pathak
Greenhorn

Joined: Jun 05, 2002
Posts: 27
Hi,
I want to implement following functionality. I have an application where there can be number of users logged in at a time. Now we have a special user called as Admin. We need to provide a way for admin to logout the other users. We are storing the user authentication information in the session for every user. So one of the way is to get all the session objects and invalidate the ones which satisfy certain condition. How do I do this ?
In other words I want to get the HTTPSession objects for all the sessions currently maintained by the server.
Thanks in advance
Sachin
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12758
    
    5
Although the servlet API used to have more direct functions for this, they were removed due to security concerns.
You are going to have to "roll your own" by using the various session listeners. Exactly how depends on which servlet API your server implements.
See for example javax.servlet.http.HttpSessionListener - new with api 2.3
Bill
 
Don't get me started about those stupid light bulbs.
 
subject: Accessing session of another user
 
Similar Threads
Need weblogic specific classes to get reference to HttpSession object
explicitly making any user logout from the site
Kill sessions from tomcat
Session Handling- How restrict to only one admin login
Kill sessions