|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interceptor is a stateless class that follows the interceptor pattern, as
found in Filter
and in AOP languages.
ActionInvocation
execution and return a return code
(such as Action.SUCCESS
), or it may choose to do some processing before
and/or after delegating the rest of the procesing using ActionInvocation.invoke()
.
Interceptor's parameter could be overriden through the following ways :-
Method 1:
<action name="myAction" class="myActionClass"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="params"/> <interceptor-ref name="servlet-config"/> <interceptor-ref name="prepare"/> <interceptor-ref name="i18n"/> <interceptor-ref name="chain"/> <interceptor-ref name="model-driven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="static-params"/> <interceptor-ref name="params"/> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">myValidationExcudeMethod</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludeMethods">myWorkflowExcludeMethod</param> </interceptor-ref> </action>Method 2:
<action name="myAction" class="myActionClass"> <interceptor-ref name="defaultStack"> <param name="validation.excludeMethods">myValidationExcludeMethod</param> <param name="workflow.excludeMethods">myWorkflowExcludeMethod</param> </interceptor-ref> </action>In the first method, the whole default stack is copied and the parameter then changed accordingly. In the second method, the
<interceptor-name>.<parameter-name>Note also that in this case the
Method Summary | |
void |
destroy()
Called to let an interceptor clean up any resources it has allocated. |
void |
init()
Called after an interceptor is created, but before any requests are processed using intercept , giving
the Interceptor a chance to initialize any needed resources. |
String |
intercept(ActionInvocation invocation)
Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the request by the ActionInvocation or to short-circuit the processing and just return a String return code. |
Method Detail |
public void destroy()
public void init()
intercept
, giving
the Interceptor a chance to initialize any needed resources.
public String intercept(ActionInvocation invocation) throws Exception
ActionInvocation
or to short-circuit the processing and just return a String return code.
ActionInvocation.invoke()
, or from the interceptor itself.
Exception
- any system-level error, as defined in Action.execute()
.
|
XWork Project Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |