com.opensymphony.webwork.interceptor
Class SessionInvalidationInterceptor

java.lang.Object
  extended by com.opensymphony.xwork.interceptor.AroundInterceptor
      extended by com.opensymphony.webwork.interceptor.SessionInvalidationInterceptor
All Implemented Interfaces:
Interceptor, Serializable

public class SessionInvalidationInterceptor
extends AroundInterceptor

This interceptor invalidates http session based on the type of operation it is in. There's three type of operations:-

No intended extension points.
 
 
 <action name="logout" ... >
        <intereptor-ref name="sessionInvalidate">
            <param name="type">Now</param>
     </interceptor-ref>
     ....
 </action>
   
  or 
  
  <action name="sayByeByeNextRequestWillHaveSessionLost" ... >
      <interceptor-ref name="sessionInvalidate">
        <param name="type"<NextRequest</param>
      </interceptor-ref>
      ....
  </action>
  
  <!-- This is the next request, "sessionInvalidate"  will find the marker inserted
          by the action above and invalidate the session -->
  <!-- The type="NoOperation" is just there so that the type is a valid one, and 
         we don't get a warning log meessage -->        
  <action name="nextRequest" ... >
        <interceptor-ref name="sessionInvalidate">
                <param name="type">NoOperation</param>
     </interceptor-ref>
      ...
  </action>
 
 
 

Version:
$Date: 2006-12-11 20:45:46 +0800 (Mon, 11 Dec 2006) $ $Id: SessionInvalidationInterceptor.java 2757 2006-12-11 12:45:46Z tmjee $
Author:
tmjee
See Also:
Serialized Form

Field Summary
protected  String key
           
static String NEXT_REQUEST
           
static String NO_OPERATION
           
static String NOW
           
protected  String type
           
 
Fields inherited from class com.opensymphony.xwork.interceptor.AroundInterceptor
log
 
Constructor Summary
SessionInvalidationInterceptor()
           
 
Method Summary
protected  void after(ActionInvocation invocation, String result)
          Decides if this interceptor should invalidate the session or mark the session to be invalidated upon the next request that contains this interceptor in the stack.
protected  void before(ActionInvocation invocation)
          Invalidate this session if it is marked to be invalidated from previous request.
 String getKey()
          Get the session key, of which this interceptor will use to mark if the next request with this interceptor in the stack should have the session invalidated.
 String getType()
          Returns the operation type.
 void setKey(String key)
          Set the session key, of which this interceptor will use to mark if the next request with this interceptor in the stack should have the session invalidated.
 void setType(String type)
          Set the operation type, either 'NextRequest', 'Now', or 'NoOperation' (default).
 
Methods inherited from class com.opensymphony.xwork.interceptor.AroundInterceptor
destroy, init, intercept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEXT_REQUEST

public static String NEXT_REQUEST

NOW

public static String NOW

NO_OPERATION

public static String NO_OPERATION

key

protected String key

type

protected String type
Constructor Detail

SessionInvalidationInterceptor

public SessionInvalidationInterceptor()
Method Detail

setKey

public void setKey(String key)
Set the session key, of which this interceptor will use to mark if the next request with this interceptor in the stack should have the session invalidated.

Parameters:
key -

getKey

public String getKey()
Get the session key, of which this interceptor will use to mark if the next request with this interceptor in the stack should have the session invalidated.

Returns:
String

setType

public void setType(String type)
Set the operation type, either 'NextRequest', 'Now', or 'NoOperation' (default).

Parameters:
key -

getType

public String getType()
Returns the operation type.

Returns:
String

after

protected void after(ActionInvocation invocation,
                     String result)
              throws Exception
Decides if this interceptor should invalidate the session or mark the session to be invalidated upon the next request that contains this interceptor in the stack.

Specified by:
after in class AroundInterceptor
result - the result value returned by the invocation
Throws:
Exception
See Also:
AroundInterceptor.after(com.opensymphony.xwork.ActionInvocation, java.lang.String)

before

protected void before(ActionInvocation invocation)
               throws Exception
Invalidate this session if it is marked to be invalidated from previous request.

Specified by:
before in class AroundInterceptor
Throws:
Exception
See Also:
AroundInterceptor.before(com.opensymphony.xwork.ActionInvocation)

WebWork Project Page