It's a developer notification that is invoked from the method
protected boolean isAccepted(String paramName) {
AcceptedPatternsChecker.IsAccepted result = acceptedPatterns.isAccepted(paramName);
if (result.isAccepted()) {
return true;
}
notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", paramName, result.getAcceptedPattern());
return false;
}
it means that if the parameter name matches the list of accepted patterns, then it's passed by this interceptor (after checks for name length, and if it's not excluded).
New interceptor also checks the acceptance of the parameter value.
The whitelist and blacklist of parameters are managed by the ParameterNameAware
action separately.
Note:
Using ParameterNameAware
could be dangerous as
ParameterNameAware#acceptableParameterName(String)
takes precedence
over ParametersInterceptor
which means if ParametersInterceptor
excluded given parameter name you can accept it with
ParameterNameAware#acceptableParameterName(String)
.
The default list of patterns are settled during initialization (it's hardcoded using default constant value), so if you didn't use a parameter acceptParamNames
in the interceptor configuration, Struts will use its default pattern list. But you can override the parameter value by specifying this parameter to the parameters interceptor.
Note: The method notifyDeveloper
should only print in devMode
, otherwise it prints only in DEBUG
mode of the logger. You can also trace massages by changing a logger level to TRACE
.
To use a method
attribute of the submit tag you should:
- Enable DMI:
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
2. Override the list of excluded patterns.
the default list of exluded patterns contains a pattern that excludes method:
parameter (and action:
too). That is also mentioned by AleksandrM in the comment.
For more information see documentation for params
interceptor.