Hi Chris,

Session.invalidate() is being called by Tomcat on session timeout, which is
the same call that is given when you implicitly invalidate the session in
your servlet code. Once session.invalidate() has been called, you no longer
have any session properties to get, including your session listener. Also,
you're gonna need to add some properties to your session object to determine
how/why the session was invalidated. Just using the API calls without any
"support staff" will not be sufficient.

scott


----- Original Message -----
From: "Chris Wilson" <[EMAIL PROTECTED]>
To: "tomcat" <[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 2:38 PM
Subject: HttpSession invalidate bug???


> Hello,
>
> I'm calling session.getMaxInactiveInterval() on a session after it has
> been invalidated.
>
> Tomcat is throwing an IllegalStateException and saying that method
> cannot be called on an invalid session.  However, the Servlet 2.3 API
> docs do not state that IllegalStateException should be thrown (as it is
> with many other methods in HttpSession) from getMaxInactiveInterval().
>
> The reason I've run into this problem is because I'm trying to write a
> HttpSessionAttributeListener that determines if the session is being
> explicitly invalidated or if it timed out.
>
> The Servlet 2.3 spec (section 10.7) states,
>
> "It is often useful in tracking sessions to know whether a session
> became invalid because the container timed out the session, or because a
> web component within the application called the invalidate method. The
> destinction may be determined indirectly using listeners and the
> HTTPSession API methods."
>
> If I can't call getMaxInactiveInterval() on an invalidated session, how
> can I determine if the session was invalidated due to time out?  Is this
> a bug in Tomcat?  It seems so since it doesn't follow the API docs for
> this call.
>
> Thanks in advance for any insight.
>
> Chris Wilson
>
> [EMAIL PROTECTED]
> www.wondergeek.com
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to