jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes How to find online users in webapplication? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to find online users in webapplication?" Watch "How to find online users in webapplication?" New topic

How to find online users in webapplication?

vijaya vinayagam

Joined: Dec 09, 2005
Posts: 21
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

Joined: Dec 11, 2004
Posts: 13410

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.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
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?
I agree. Here's the link: http://aspose.com/file-tools
subject: How to find online users in webapplication?
It's not a secret anymore!