You should really use the lifecycle listener approach and roll your own
hashtable- or list-based implementation, depending on your needs. Going for
the internals is cool, but it is a non-portable hack.
HttpSessionListener is the way to go, IMHO.
fillup
On 5/27/02 3:13 PM, Mats Nyberg [EMAIL
out to
fire an event to tell the 'master list' that that specific user is gone.
any code is help...
THanks
Terrence
From: Phillip Morelock [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Listing all currently logged users
Hey Phillip,
works great
thanks alot for your help
Terrence
From: Phillip Morelock [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Listing all currently logged users
Date: Tue, 28 May 2002 11:15:40 -0700
MIME-Version: 1.0
Is it possible to list all the users who are currently logged in?
I'm using FORM authentication with a JDBC Realm.
Basically what I want is for users to be able to see who's currently online
(other users).
Is there a simple way of approaching this?
and if I were to have to write something
I'm not sure if this is the best way, but I added a HttpSessionListener
to find out when
sessions were created / destroyed and just maintained a list.
It is probably more portable than hacking your way into Catalina internals.
See the servlet spec for details on lifecycle listeners.
Terrence
You can create a boolean field in the user's table (logged), when the user
logs, it is setted to true and when the session ends or the user logsout,
set it to false, then create a query that extracts all user where
logged=true.
+-+
Juan Jose Velazquez Garcia
not beeing the expert I'd take any suitable Realm-interceptor (e.g.*
org.apache.tomcat.request.SimpleRealm*,
or whatever you use depending on your source of userdata).
I'd subclass it only to maintain a list of people logging in. should be
done in a jiffy, eh ;)
~mats
Ben Walding wrote: