public class AliasInterceptor extends AbstractInterceptor
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> <interceptor-ref name="alias"/> <interceptor-ref name="basicStack"/> <result name="success">good_result.ftl</result> </action>
Modifier and Type | Field and Description |
---|---|
protected String |
aliasesKey |
protected boolean |
devMode |
protected LocalizedTextProvider |
localizedTextProvider |
protected ValueStackFactory |
valueStackFactory |
Constructor and Description |
---|
AliasInterceptor() |
Modifier and Type | Method and Description |
---|---|
String |
intercept(ActionInvocation invocation)
Override to handle interception
|
protected boolean |
isAccepted(String paramName) |
protected boolean |
isExcluded(String paramName) |
protected boolean |
isNotAcceptableExpression(String expression)
Checks if expression contains vulnerable code
|
void |
setAcceptedPatterns(AcceptedPatternsChecker acceptedPatterns) |
void |
setAcceptParamNames(String commaDelim)
Sets a comma-delimited list of regular expressions to match
parameters that are allowed in the parameter map (aka whitelist).
|
void |
setAliasesKey(String aliasesKey)
Sets the name of the action parameter to look for the alias map.
|
void |
setDevMode(String mode) |
void |
setExcludedPatterns(ExcludedPatternsChecker excludedPatterns) |
void |
setExcludeParams(String commaDelim)
Sets a comma-delimited list of regular expressions to match
parameters that should be removed from the parameter map.
|
void |
setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) |
void |
setValueStackFactory(ValueStackFactory valueStackFactory) |
destroy, init, setDisabled, shouldIntercept
protected String aliasesKey
protected ValueStackFactory valueStackFactory
protected LocalizedTextProvider localizedTextProvider
protected boolean devMode
public void setDevMode(String mode)
public void setValueStackFactory(ValueStackFactory valueStackFactory)
public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider)
public void setExcludedPatterns(ExcludedPatternsChecker excludedPatterns)
public void setAcceptedPatterns(AcceptedPatternsChecker acceptedPatterns)
public void setAliasesKey(String aliasesKey)
Sets the name of the action parameter to look for the alias map.
Default is aliases
.
aliasesKey
- the name of the action parameterpublic String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.protected boolean isAccepted(String paramName)
protected boolean isExcluded(String paramName)
protected boolean isNotAcceptableExpression(String expression)
expression
- of interceptorpublic void setAcceptParamNames(String commaDelim)
Don't change the default unless you know what you are doing in terms of security implications.
commaDelim
- A comma-delimited list of regular expressionspublic void setExcludeParams(String commaDelim)
commaDelim
- A comma-delimited list of regular expressionsCopyright © 2000–2024 Apache Software Foundation. All rights reserved.