public class RestWorkflowInterceptor
extends com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
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.
MethodFilterInterceptor
for more info.
Interceptor parameters:
<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> </action> <-- 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> </action> <-- 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> </interceptor-ref> <result name="success">good_result.ftl</result> </action>
Constructor and Description |
---|
RestWorkflowInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected String |
doIntercept(com.opensymphony.xwork2.ActionInvocation invocation)
Intercept
ActionInvocation and processes the errors using the ContentTypeHandler
appropriate for the request. |
void |
setContentTypeHandlerManager(ContentTypeHandlerManager mgr) |
void |
setEditMethodName(String editMethodName) |
void |
setInputResultName(String inputResultName)
Set the
inputResultName (result name to be returned when
a action / field error is found registered). |
void |
setNewMethodName(String newMethodName) |
void |
setPostMethodName(String postMethodName) |
void |
setPutMethodName(String putMethodName) |
void |
setValidationFailureStatusCode(String code) |
public void setPostMethodName(String postMethodName)
public void setEditMethodName(String editMethodName)
public void setNewMethodName(String newMethodName)
public void setPutMethodName(String putMethodName)
public void setValidationFailureStatusCode(String code)
public void setContentTypeHandlerManager(ContentTypeHandlerManager mgr)
public void setInputResultName(String inputResultName)
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 String doIntercept(com.opensymphony.xwork2.ActionInvocation invocation) throws Exception
ActionInvocation
and processes the errors using the ContentTypeHandler
appropriate for the request.doIntercept
in class com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
Exception
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.