Question:
How may I safely call 'session.invalidate()' from a screen (or action)
class?
i.e. without causing an exception from doGet()?

I've created a Logout screen which extends VelocityScreen.
It makes the following calls:
        HttpSession session = data.getRequest().getSession();
        session.invalidate();

The above code runs as expected (sort of) and my logout screen is rendered
to the browser.
The problem is that the default Error screen is appended to my logout
screen.  This happens do to an exception in doGet()

Turbine.log contains the following stack trace leading to Turbine.doGet():

[Wed Apr 10 16:16:46 PDT 2002] -- INFO -- Entering screen Logout.java
[Wed Apr 10 16:16:46 PDT 2002] -- INFO -- Leaving screen Logout.java
[Wed Apr 10 16:16:46 PDT 2002] -- ERROR -- Turbine.handleException:
removeAttribute: Session already invalidated
[Wed Apr 10 16:16:46 PDT 2002] -- ERROR -- 
        Exception:  java.lang.IllegalStateException: removeAttribute:
Session already invalidated
        Stack Trace follows:
        java.lang.IllegalStateException: removeAttribute: Session already
invalidated
        at
org.apache.catalina.session.StandardSession.removeAttribute(StandardSession.
java:1052)
        at
org.apache.catalina.session.StandardSessionFacade.removeAttribute(StandardSe
ssionFacade.java:201)
        at
org.apache.catalina.session.StandardSessionFacade.removeValue(StandardSessio
nFacade.java:206)
        at org.apache.turbine.Turbine.doGet(Turbine.java:453)
... SNIP....

FYI, I am using TDK 2.1 & Tomcat4 with container managed security (not
Turbine's User or ACL stuff).  I've created a form-based login and need to
provide logout functionality.  I am trying to implement the logout via
session.invalidate() which should force Tomcat to redirect subsequent
requests back to the login page.

Thanks for any help.
  David




*********************************************************************
This e-mail and any attachment is confidential. It may only be read, copied and used 
by the intended recipient(s). If you are not the intended recipient(s), you may not 
copy, use, distribute, forward, store or disclose this e-mail or any attachment. If 
you are not the intended recipient(s) or have otherwise received this e-mail in error, 
you should destroy it and any attachment and notify the sender by reply e-mail or send 
a message to [EMAIL PROTECTED]
*********************************************************************


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

Reply via email to