tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Sessions
Date Fri, 09 Nov 2001 16:48:53 GMT

On Fri, 9 Nov 2001, Roland Carlsson wrote:

> Date: Fri, 9 Nov 2001 08:56:50 +0100
> From: Roland Carlsson <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: Sessions
> Hi!
> I wanna se how many sessions I have on a host. But since the servlet
> api doesn't allow me to do this kind of groupfunctions I wonder if
> there is a "hack" I can do to get this information. Or is there
> another way of doing this that perhaps is a little more transportable
> then hackning a Tomcat-class?

In a Servlet 2.3 environment, you can accumulate this information by
registering an HttpSessionListener that is called when sessions are
created and destroyed.  In the listener, you could keep your own HashMap
of the session objects.

In a Servlet 2.2 environment, the only practical way is to make sure that
your application always stores an object in the session at login time, and
the object's class implements HttpSessionBindingListener.  You could do
the same sort of tracking in the valueBound() and valueUnbound() methods
of this listener.

> Thanks in advance
> Roland Carlsson


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message