Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find online users in webapplication?

 
vijaya vinayagam
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to get the total number of logged in users at any point in web application

using Tomcat 5.0 as application server

thanks in advance
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat's manager application can tell you the number of active sessions.
This doesn't necessarily correlate to the actual number of people using your application.
HTTP is a stateless protocol. There is nothing to end a session if a user moves on to another site or cloeses their browser.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this is a feature of the application, then I would use a HttpSessionListener to count/register all the sessions created/removed into a context attribute, say a Map. And now, any servlet (better protected by some security features) can access the context attribute and count the number of active session object there.

Would there be any better strategy?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic