tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Replacement for HTTPSessionContext!?
Date Fri, 28 Sep 2001 01:58:07 GMT


On Thu, 27 Sep 2001, Alex Colic wrote:

> Date: Thu, 27 Sep 2001 16:27:03 -0400
> From: Alex Colic <alex.colic@pop-ware.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: Tomcat-User <tomcat-user@jakarta.apache.org>
> Subject: Replacement for HTTPSessionContext!?
>
> Hi, is there a replacement for HTTPSessionContext.

Not in the servlet API.

> I need a way to
> invalidate all the users logged in to my web app at once.
>
> I am looking for a way to get a list of sessions and then invalidate them.
>

You need to arrange to accumulate a list of sessions as they are created
(and remove them as they are invalidated or timed out).  Two techniques
are common:

* Have your app add a session attribute to every new session that
  implements HttpSessionBindingListener.  This object will be notified
  when the object is bound (signifying session creation) or unbound
  (signifying session timeout or invalidation).  You can use these
  signals to maintain your own HashMap of sessions someplace.

* (Servlet 2.3 Only) Register a listener class that implements the new
  javax.servlet.http.HttpSessionListener interface.  You'll be notified
  about session creation and removal even if the app never stores any
  attributes.

> Thanks for any help.
>
> Alex
>
>

Craig



Mime
View raw message