• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieveing all active sessions

 
Nicolaos Kormara
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.

I was just wondering if it is possible to retrieve a list of all active sessions in a servlet container.

Could anyone please point me to an article so that I may learn how this could be done.

hank you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We used to have the SessionContext object with a getIds and getSession(id) methods but those have been deprecated (for security reasons) for a long time.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionContext.html#getIds()

With listeners, you can implement your own solution for storing references to sessions in a context scope object and then read from that with a Servlet.

I have a demo app that does this.
http://simple.souther.us/not-so-simple.html

Look for SessionMonitor.
 
Nicolaos Kormara
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just started to look at the mechanism of SessionListeners with your example. I feel it will be quite useful.

Thank you very much for your response and help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!