Class TokenSessionStoreInterceptor

  extended by com.opensymphony.xwork2.interceptor.AbstractInterceptor
      extended by com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
          extended by org.apache.struts2.interceptor.TokenInterceptor
              extended by org.apache.struts2.interceptor.TokenSessionStoreInterceptor
All Implemented Interfaces:
Interceptor, Serializable

public class TokenSessionStoreInterceptor
extends TokenInterceptor

This interceptor builds off of the TokenInterceptor, providing advanced logic for handling invalid tokens. Unlike the normal token interceptor, this interceptor will attempt to provide intelligent fail-over in the event of multiple requests using the same session. That is, it will block subsequent requests until the first request is complete, and then instead of returning the invalid.token code, it will attempt to display the same response that the original, valid action invocation would have displayed if no multiple requests were submitted in the first place.

NOTE: As this method extends off MethodFilterInterceptor, it is capable of deciding if it is applicable only to selective methods in the action class. See MethodFilterInterceptor for more info.

Interceptor parameters:

Extending the interceptor:

There are no known extension points for this interceptor.

Example code:


 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="token-session/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>

 <-- In this case, myMethod of the action class will not
        get checked for invalidity of token -->
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="token-session>
         <param name="excludeMethods">myMethod</param>
     </interceptor-ref name="token-session>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>


See Also:
Serialized Form

Field Summary
private static long serialVersionUID
Fields inherited from class org.apache.struts2.interceptor.TokenInterceptor
Fields inherited from class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
excludeMethods, includeMethods, log
Constructor Summary
Method Summary
protected  String handleInvalidToken(ActionInvocation invocation)
          Determines what to do if an invalida token is provided.
protected  String handleValidToken(ActionInvocation invocation)
          Called when a valid token is found.
Methods inherited from class org.apache.struts2.interceptor.TokenInterceptor
Methods inherited from class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
applyInterceptor, getExcludeMethodsSet, getIncludeMethodsSet, intercept, setExcludeMethods, setIncludeMethods
Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
destroy, init
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail


public TokenSessionStoreInterceptor()
Method Detail


protected String handleInvalidToken(ActionInvocation invocation)
                             throws Exception
Description copied from class: TokenInterceptor
Determines what to do if an invalida token is provided. If the action implements ValidationAware

handleInvalidToken in class TokenInterceptor
invocation - the action invocation where the invalid token failed
the return code to indicate should be processed
Exception - when any unexpected error occurs.


protected String handleValidToken(ActionInvocation invocation)
                           throws Exception
Description copied from class: TokenInterceptor
Called when a valid token is found. This method invokes the action by can be changed to do something more interesting.

handleValidToken in class TokenInterceptor
invocation - the action invocation
Exception - when any unexpected error occurs.

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.