tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Davidson" <tim.david...@greenhatconsulting.com>
Subject RE: Checking for invalidated session
Date Fri, 01 Aug 2003 08:10:13 GMT
But surely theres a better way?
 Whould I be better off replacing "session.invalidate()" with "session = null"?

-----Original Message-----
From: Justin Ruthenbeck [mailto:justinr@nextengine.com]
Sent: Thursday, July 31, 2003 6:44 PM
To: Tomcat Users List
Subject: Re: Checking for invalidated session


At 08:31 AM 7/31/2003, you wrote:
>How can you check to see if a session has already been validated?
>i.e.
>  if( !session.isInvalidated()) <-- what should go here?
>{
>         session.invalidate();
>}
>
>to prevent the following exception:
>"org.apache.jasper.JasperException: invalidate: Session already invalidated"

If you don't want to just catch and ignore the JasperException, then use 
something like this:

try
{
     session.getAttributeNames();
}
catch (java.lang.IllegalStateException isse)
{
     // Session is already invalid
}

justin

____________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
justinr - AT - nextengine DOT com
Confidential
    See http://www.nextengine.com/confidentiality.php
____________________________________


---------------------------------------------------------------------
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