tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fran├žois Richard <frich...@sofice.fr>
Subject Re: How to know the list of the active sessions
Date Wed, 06 Oct 2004 13:59:06 GMT
Thanks Yoav and Tim, I will studied your solutions  ...

Shapira, Yoav wrote:

>Hi,
>
>  
>
>>Enumeration list = servletContext.getActiveSession();
>>
>>To solve this problem i have put a list attribute in the context. And
>>use a session listener to refresh this list ... but the problem is that
>>the session are persistent during a stop but not the context attributes
>>which became outdated ...
>>    
>>
>
>Your solution isn't far from what you need.  But you might want to read
>the Servlet Spec or its JavaDocs a tiny bit more, where you'll discover
>the HttpSessionActivationListener.
>
>Write a listener that's both an HttpSessionListener and an
>HttpSessionActivationListener.  Have this listener maintain a list (or
>map by session ID, or Set to prevent duplicates, or whatever data
>structure fits your needs) of active sessions.  Add to the list both
>when a session is created and when it's activated, and remove from it
>both when it's destroyed and when it's passivated.  At least that will
>be the initial version of your listener.  Test and tweak as needed for
>whatever your requirements are.
>
>Yoav
>
>
>
>This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message