Package org.apache.struts2.interceptor
Class AliasInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.AliasInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
 The aim of this Interceptor is to alias a named parameter to a different named parameter. By acting as the glue
 between actions sharing similar 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:
- aliasesKey (optional) - the name of the action parameter to look for the alias map (by default this is aliases).
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>
     <interceptor-ref name="alias"/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 - Author:
- Matthew Payne
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Stringprotected booleanprotected LocalizedTextProviderprotected ValueStackFactory
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintercept(ActionInvocation invocation) Override to handle interceptionprotected booleanisAccepted(String paramName) protected booleanisExcluded(String paramName) protected booleanisNotAcceptableExpression(String expression) Checks if expression contains vulnerable codevoidsetAcceptedPatterns(AcceptedPatternsChecker acceptedPatterns) voidsetAcceptParamNames(String commaDelim) Sets a comma-delimited list of regular expressions to match parameters that are allowed in the parameter map (aka whitelist).voidsetAliasesKey(String aliasesKey) Sets the name of the action parameter to look for the alias map.voidsetDevMode(String mode) voidsetExcludedPatterns(ExcludedPatternsChecker excludedPatterns) voidsetExcludeParams(String commaDelim) Sets a comma-delimited list of regular expressions to match parameters that should be removed from the parameter map.voidsetLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) voidsetValueStackFactory(ValueStackFactory valueStackFactory) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Field Details- 
aliasesKey
- 
valueStackFactory
- 
localizedTextProvider
- 
devModeprotected boolean devMode
 
- 
- 
Constructor Details- 
AliasInterceptorpublic AliasInterceptor()
 
- 
- 
Method Details- 
setDevMode
- 
setValueStackFactory
- 
setLocalizedTextProvider
- 
setExcludedPatterns
- 
setAcceptedPatterns
- 
setAliasesKeySets the name of the action parameter to look for the alias map. Default is aliases.- Parameters:
- aliasesKey- the name of the action parameter
 
- 
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().
 
- 
isAccepted
- 
isExcluded
- 
isNotAcceptableExpressionChecks if expression contains vulnerable code- Parameters:
- expression- of interceptor
- Returns:
- true|false
 
- 
setAcceptParamNamesSets a comma-delimited list of regular expressions to match parameters that are allowed in the parameter map (aka whitelist).Don't change the default unless you know what you are doing in terms of security implications. - Parameters:
- commaDelim- A comma-delimited list of regular expressions
 
- 
setExcludeParamsSets a comma-delimited list of regular expressions to match parameters that should be removed from the parameter map.- Parameters:
- commaDelim- A comma-delimited list of regular expressions
 
 
-