You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matthew Preston <ma...@knowledgeview.co.uk> on 2000/12/08 13:53:36 UTC

Session snooper

I'm need to create a simple tool for Tomcat so that I can see how many users
have active sessions for the available Contexts.  e.g. how many sessions are
active for /admin with details for each.

Rather than reinventing the wheel I was wondering if someone has already
created such a beast - it seems like useful tool to have.

Any ideas?

Cheers,
Matt


Re: Session snooper

Posted by Kief Morris <ki...@bitBull.com>.
Craig R. McClanahan typed the following on 11:40 08/12/2000 -0800
>> I'm need to create a simple tool for Tomcat so that I can see how many users
>> have active sessions for the available Contexts.  e.g. how many sessions are
>> active for /admin with details for each.
...
>Under a servlet 2.3 environment (Tomcat 4.x), you can use an application event
>listener to do stuff like this in a generic way.

I'm writing a 2.3 servlet which does this, both to demonstrate various session related 
events in the 2.3 spec and as a debugging/system monitoring tool. I'll put the code up
when it's finished. It's not very complex, but it's not at the top of my work queue at
the moment, so it may be this weekend. I'll contribute it to the Jakarta project if there's
interest.

The architecture is a class which implements the listener interfaces and maintains
a list of active sessions, and also logs various attribute related events. A separate
servlet class makes use of this class to display current session data.

Kief

---
              bitBull makes the Internet bite: http://www.bitBull.com/demos/


Re: Session snooper

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Matthew Preston wrote:

> I'm need to create a simple tool for Tomcat so that I can see how many users
> have active sessions for the available Contexts.  e.g. how many sessions are
> active for /admin with details for each.
>
> Rather than reinventing the wheel I was wondering if someone has already
> created such a beast - it seems like useful tool to have.
>

Under a servlet 2.2 environment (Tomcat 3.x), it is not feasible to write such a
generic tool without some help by your application (the login process adds an
object to the session that implements HttpSessionBindingListener that keeps a
local collection of active sessions), or writing custom extensions to Tomcat.

Under a servlet 2.3 environment (Tomcat 4.x), you can use an application event
listener to do stuff like this in a generic way.

>
> Any ideas?
>
> Cheers,
> Matt

Craig McClanahan