Class RestWorkflowInterceptor

  extended by com.opensymphony.xwork2.interceptor.AbstractInterceptor
      extended by com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
          extended by
All Implemented Interfaces:

public class RestWorkflowInterceptor
extends MethodFilterInterceptor

An interceptor that makes sure there are not validation errors before allowing the interceptor chain to continue. This interceptor does not perform any validation.

Copied from the DefaultWorkflowInterceptor, this interceptor adds support for error handling of Restful operations. For example, if an validation error is discovered, a map of errors is created and processed to be returned, using the appropriate content handler for rendering the body.

This interceptor does nothing if the name of the method being invoked is specified in the excludeMethods parameter. excludeMethods accepts a comma-delimited list of method names. For example, requests to foo!input.action and foo!back.action will be skipped by this interceptor if you set the excludeMethods parameter to "input, back". Note: As this method extends off MethodFilterInterceptor, it is capable of deciding if it is applicable only to selective methods in the action class. This is done by adding param tags for the interceptor element, naming either a list of excluded method names and/or a list of included method names, whereby includeMethods overrides excludedMethods. A single * sign is interpreted as wildcard matching all methods for both parameters. 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="params"/>
     <interceptor-ref name="validation"/>
     <interceptor-ref name="workflow"/>
     <result name="success">good_result.ftl</result>
 <-- In this case myMethod as well as mySecondMethod of the action class
        will not pass through the workflow process -->
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="params"/>
     <interceptor-ref name="validation"/>
     <interceptor-ref name="workflow">
         <param name="excludeMethods">myMethod,mySecondMethod</param>
     </interceptor-ref name="workflow">
     <result name="success">good_result.ftl</result>

 <-- In this case, the result named "error" will be used when
        an action / field error is found -->
 <-- The Interceptor will only be applied for myWorkflowMethod method of action
        classes, since this is the only included method while any others are excluded -->
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="params"/>
     <interceptor-ref name="validation"/>
     <interceptor-ref name="workflow">
        <param name="inputResultName">error</param>
         <param name="excludeMethods">*</param>
         <param name="includeMethods">myWorkflowMethod</param>
     <result name="success">good_result.ftl</result>


Jason Carreira, Rainer Hermanns, Alexandru Popescu, Philip Luppens, tm_jee
See Also:
Serialized Form

Field Summary
Fields inherited from class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
excludeMethods, includeMethods, log
Constructor Summary
Method Summary
protected  java.lang.String doIntercept(ActionInvocation invocation)
          Intercept ActionInvocation and processes the errors using the ContentTypeHandler appropriate for the request.
 void setContentTypeHandlerManager(ContentTypeHandlerManager mgr)
 void setEditMethodName(java.lang.String editMethodName)
 void setInputResultName(java.lang.String inputResultName)
          Set the inputResultName (result name to be returned when a action / field error is found registered).
 void setNewMethodName(java.lang.String newMethodName)
 void setPostMethodName(java.lang.String postMethodName)
 void setPutMethodName(java.lang.String putMethodName)
 void setValidationFailureStatusCode(java.lang.String code)
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

Constructor Detail


public RestWorkflowInterceptor()
Method Detail


public void setPostMethodName(java.lang.String postMethodName)


public void setEditMethodName(java.lang.String editMethodName)


public void setNewMethodName(java.lang.String newMethodName)


public void setPutMethodName(java.lang.String putMethodName)


public void setValidationFailureStatusCode(java.lang.String code)


public void setContentTypeHandlerManager(ContentTypeHandlerManager mgr)


public void setInputResultName(java.lang.String inputResultName)
Set the inputResultName (result name to be returned when a action / field error is found registered). Default to Action.INPUT

inputResultName - what result name to use when there was validation error(s).


protected java.lang.String doIntercept(ActionInvocation invocation)
                                throws java.lang.Exception
Intercept ActionInvocation and processes the errors using the ContentTypeHandler appropriate for the request.

Specified by:
doIntercept in class MethodFilterInterceptor
String result name

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