On Fri, 13 Dec 2002, Garrett Smith wrote:
> Date: Fri, 13 Dec 2002 18:04:42 -0800 (PST) > From: Garrett Smith <[EMAIL PROTECTED]> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > To: Tomcat Users List <[EMAIL PROTECTED]> > Subject: HttpSessionListener beforeSessionDestroyed (Craig, Sean)? > > Hello Everyone in Java Land, > > I want to use beforeSessionDestroyed. Before going off and extending > HttpSessionListener, I decided to see if it'd been done (why reinvent the > wheel?). > > I searched on google for my aptly-named method, and found this: > > http://archives2.real-time.com/pipermail/tomcat-devel/2002-March/028610.html > > How can I use this? is there an interface for a StandardHttpSessionListener or > something? If so, does beforeSessionDestroyed give me access to the session > that is about to be destroyed? > > If not, I propose to make an interface that extends HttpSessionListener and > provides for beforeSessionDestroyed. To do this, I will create and store a list > in application scope. Each session will get added to the list. When a session > is destroyed, I can loop through the list and find out which session expired: > In Servlet 2.3, the sessionDestroyed() method is called *after* the session has been expired. In Servlet 2.4 (which is implemented by Tomcat 5), the current leaning of the expert group is towards changing the semantics of this to occur *before* the session is destroyed instead. > for(i = 0; i < list.size(); i ++){ > > session = list.get(i); > > if(System.currentTimeMillis() > - session.getLastAccessedTime() > > session.getMaxInactiveInterval()) > beforeSessionDestroyed(session); > > list.remove(i) = null; > } > > Any advice? > Obviously, this is not something that could be done in Tomcat by itself, because it requires a change to the Servlet API. That can only be done by the JSR-154 expert group. To send them your feedback, mail to: [EMAIL PROTECTED] > Garrett > Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
