com.opensymphony.xwork.interceptor
Class AliasInterceptor

java.lang.Object
  extended bycom.opensymphony.xwork.interceptor.AroundInterceptor
      extended bycom.opensymphony.xwork.interceptor.AliasInterceptor
All Implemented Interfaces:
Interceptor, Serializable

public class AliasInterceptor
extends AroundInterceptor

The aim of this Interceptor is to alias a named parameter to a different named parameter. By acting as the glue between actions sharing similiar parameters (but with different names), it can help greatly with action chaining.

Action's alias expressions should be in the form of #{ "name1" : "alias1", "name2" : "alias2" }. This means that assuming an action (or something else in the stack) has a value for the expression named name1 and the action this interceptor is applied to has a setter named alias1, alias1 will be set with the value from name1.

Interceptor parameters:

Extending the interceptor:

This interceptor does not have any known extension points.

Example code:

 
 <action name="someAction" class="com.examples.SomeAction">
     <!-- The value for the foo parameter will be applied as if it were named bar -->
     <param name="aliases">#{ 'foo' : 'bar' }</param>

     <!-- note: the alias interceptor is included with the defaultStack in webwork-default.xml -->
     <interceptor-ref name="alias"/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 

Author:
Matthew Payne
See Also:
Serialized Form

Field Summary
protected  String aliasesKey
           
 
Constructor Summary
AliasInterceptor()
           
 
Method Summary
protected  void after(ActionInvocation invocation, String result)
          Called after the invocation has been executed.
protected  void before(ActionInvocation invocation)
          Called before the invocation has been executed.
 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.
 void setAliasesKey(String aliasesKey)
           
 
Methods inherited from class com.opensymphony.xwork.interceptor.AroundInterceptor
intercept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aliasesKey

protected String aliasesKey
Constructor Detail

AliasInterceptor

public AliasInterceptor()
Method Detail

setAliasesKey

public void setAliasesKey(String aliasesKey)

destroy

public void destroy()
Description copied from interface: Interceptor
Called to let an interceptor clean up any resources it has allocated.

Specified by:
destroy in interface Interceptor
Overrides:
destroy in class AroundInterceptor

init

public void init()
Description copied from interface: Interceptor
Called after an interceptor is created, but before any requests are processed using intercept , giving the Interceptor a chance to initialize any needed resources.

Specified by:
init in interface Interceptor
Overrides:
init in class AroundInterceptor

before

protected void before(ActionInvocation invocation)
               throws Exception
Description copied from class: AroundInterceptor
Called before the invocation has been executed.

Specified by:
before in class AroundInterceptor
Throws:
Exception

after

protected void after(ActionInvocation invocation,
                     String result)
              throws Exception
Description copied from class: AroundInterceptor
Called after the invocation has been executed.

Specified by:
after in class AroundInterceptor
Parameters:
result - the result value returned by the invocation
Throws:
Exception

XWork Project Page