I tried the first approach, it works great with 3.x.

Thank you,
Jayesh

-----Original Message-----
From: Kief Morris [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 17, 2001 8:26 AM
To: [EMAIL PROTECTED]
Subject: Re: session timeout


Jayesh typed the following on 08:00 AM 1/17/2001 -0800
>I need to do some work when tomcat session gets timed out. Could anyone of
>you suggest how I can do it.

With servlet 2.2 (Tomcat 3.x) you should make sure one of the attributes
you're
adding to the session implements HttpSessionBindingListener. When the
session
gets timed out, the container will call valueUnbound() on that object. As
long as
you know you're not the one unbinding the object (e.g. by calling
removeAttribute()
or replacing the attribute by calling setAttribute() with the same name),
you can
assume the session is being expired or invalidated.

With servlet 2.3 (Tomcat 4.x) you can also create an object which implements
HttpSessionListener, and configure it in your web.xml like this:

<web-app>

    <listener>
        <listener-class>com.foo.SessionAttributeSnoop</listener-class>
    </listener>

</web-app>

This object will have its sessionDestroyed() method called
when it is destroyed for any reason.

Of course, if the server goes down in a bad way none of these
events will be called, so there are no guarantees.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to