Class ChainingInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
 An interceptor that copies all the properties of every object in the value stack to the currently executing object,
 except for any object that implements Unchainable. A collection of optional includes and
 excludes may be provided to control how and which parameters are copied. Only includes or excludes may be
 specified. Specifying both results in undefined behavior. See the javadocs for ReflectionProvider.copy(Object, Object, java.util.Map, java.util.Collection, java.util.Collection) for more information.
 
 Note: It is important to remember that this interceptor does nothing if there are no objects already on the stack.
 
This means two things:
 
One, you can safely apply it to all your actions without any worry of adverse affects.
 
Two, it is up to you to ensure an object exists in the stack prior to invoking this action. The most typical way this is done
 is through the use of the chain result type, which combines with this interceptor to make up the action
 chaining feature.
 
Note: By default Errors, Field errors and Message aren't copied during chaining, to change the behaviour you can specify the below three constants in struts.properties or struts.xml:
- struts.chaining.copyErrors - set to true to copy Action Errors
- struts.chaining.copyFieldErrors - set to true to copy Field Errors
- struts.chaining.copyMessages - set to true to copy Action Messages
Example:
<constant name="struts.xwork.chaining.copyErrors" value="true"/>
Note: By default actionErrors and actionMessages are excluded when copping object's properties.
Interceptor parameters:- excludes (optional) - the list of parameter names to exclude from copying (all others will be included).
- includes (optional) - the list of parameter names to include when copying (all others will be excluded).
There are no known extension points to this interceptor.
Example code:
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="basicStack"/>
     <result name="success" type="chain">otherAction</result>
 </action>
 
 
 <action name="otherAction" class="com.examples.OtherAction">
     <interceptor-ref name="chain"/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 - Author:
- mrdon, tm_jee ( tm_jee(at)yahoo.co.uk )
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Collection<String>protected Collection<String>protected ReflectionProvider
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionGets list of parameter names to excludeGets list of parameter names to includeintercept(ActionInvocation invocation) Override to handle interceptionvoidsetCopyErrors(String copyErrors) voidsetCopyFieldErrors(String copyFieldErrors) voidsetCopyMessages(String copyMessages) voidsetExcludes(String excludes) Sets the list of parameter names to exclude from copying (all others will be included).voidsetExcludesCollection(Collection<String> excludes) Sets the list of parameter names to exclude from copying (all others will be included).voidsetIncludes(String includes) Sets the list of parameter names to include when copying (all others will be excluded).voidsetIncludesCollection(Collection<String> includes) Sets the list of parameter names to include when copying (all others will be excluded).voidMethods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Field Details- 
excludes
- 
includes
- 
reflectionProvider
 
- 
- 
Constructor Details- 
ChainingInterceptorpublic ChainingInterceptor()
 
- 
- 
Method Details- 
setReflectionProvider
- 
setCopyErrors
- 
setCopyFieldErrors
- 
setCopyMessages
- 
interceptDescription copied from class:AbstractInterceptorOverride to handle interception- Specified by:
- interceptin interface- Interceptor
- Specified by:
- interceptin class- AbstractInterceptor
- Parameters:
- invocation- the action invocation
- Returns:
- the return code, either returned from ActionInvocation.invoke(), or from the interceptor itself.
- Throws:
- Exception- any system-level error, as defined in- Action.execute().
 
- 
getExcludesGets list of parameter names to exclude- Returns:
- the exclude list
 
- 
setExcludesSets the list of parameter names to exclude from copying (all others will be included).- Parameters:
- excludes- the excludes list as comma separated String
 
- 
setExcludesCollectionSets the list of parameter names to exclude from copying (all others will be included).- Parameters:
- excludes- the excludes list
 
- 
getIncludesGets list of parameter names to include- Returns:
- the include list
 
- 
setIncludesSets the list of parameter names to include when copying (all others will be excluded).- Parameters:
- includes- the includes list as comma separated String
 
- 
setIncludesCollectionSets the list of parameter names to include when copying (all others will be excluded).- Parameters:
- includes- the includes list
 
 
-