tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Ruthenbeck <just...@nextengine.com>
Subject RE: Checking for invalidated session
Date Fri, 01 Aug 2003 17:25:45 GMT
At 01:10 AM 8/1/2003, you wrote:
>But surely theres a better way?
>  Whould I be better off replacing "session.invalidate()" with "session = 
> null"?

No, you wouldn't be better off -- it won't work.  :)  There's no reason not 
to like this solution, IMHO.  If it makes your code look ugly, put it in a 
static method and make it look like this:

if (SessionUtil.isInvalid(session))

justin


>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
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


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


Mime
View raw message