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 Tomcat and the fly likes Tomcat: getActiveSessions, getSessionParams(sID) -> How? 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 » Products » Tomcat
Bookmark "Tomcat: getActiveSessions, getSessionParams(sID) -> How?" Watch "Tomcat: getActiveSessions, getSessionParams(sID) -> How?" New topic

Tomcat: getActiveSessions, getSessionParams(sID) -> How?

Robert Jaeger
Ranch Hand

Joined: Apr 29, 2002
Posts: 62

I lost some hours to find a solution, finally it would be great if you could help me.

I found out how to store sessionIDs with a SessionListener.
However, later when I request them I want to get each user's session data for each running session.

Vector sessionIDs = tomcat.getSessions();
for (int s=0; s<sessionIDs.size(); s++)
String sessionID = (String) session.IDs.get(s);
HttpSession usersession = tomcat.getSession(sessionID );
System.out.println("username: " + (String)usersession.getAttribute("username")):

Is this possible?
I read someting about a StandardManager and the method findSession ... well, but don�t get it ... how do I get the right (actual) instance for this manager?

Maybe someone can help me,
that would be great.

Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Rather than going through tomcat-specific classes, how about storing a reference to the Session object, while in your session listener.

So don't just store the ID, which you'd then use to retrieve (through tomcat-specific stuff, the HttpSession).... just store the HttpSession
subject: Tomcat: getActiveSessions, getSessionParams(sID) -> How?
Similar Threads
Lost Session at JWSP-Client
Getting Date & Time from the SessoinID
URL rewriting
distinguishing 2 browsers in the same session.
Problem with session context.(Urgent)