Wouldn't be better to first check if it's an allowed-method and then
call convertParam() method ?
if (!orig.isAllowedMethod(methodName)) {
return null;
}
String methodName = convertParam(orig.getMethodName(), vars);
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
2012/1/7 <[email protected]>:
> Author: jafl
> Date: Fri Jan 6 23:19:32 2012
> New Revision: 1228497
>
> URL: http://svn.apache.org/viewvc?rev=1228497&view=rev
> Log:
> WW-3740 apply allowed-methods filter to wildcard actions
>
> Modified:
>
> struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java
>
> Modified:
> struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java
> URL:
> http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java?rev=1228497&r1=1228496&r2=1228497&view=diff
> ==============================================================================
> ---
> struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java
> (original)
> +++
> struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java
> Fri Jan 6 23:19:32 2012
> @@ -109,13 +109,17 @@ public class ActionConfigMatcher extends
> */
> @Override public ActionConfig convert(String path, ActionConfig orig,
> Map<String, String> vars) {
> -
> - String className = convertParam(orig.getClassName(), vars);
> +
> String methodName = convertParam(orig.getMethodName(), vars);
> + if (!orig.isAllowedMethod(methodName)) {
> + return null;
> + }
> +
> + String className = convertParam(orig.getClassName(), vars);
> String pkgName = convertParam(orig.getPackageName(), vars);
> -
> +
> Map<String,String> params = replaceParameters(orig.getParams(), vars);
> -
> +
> Map<String,ResultConfig> results = new
> LinkedHashMap<String,ResultConfig>();
> for (String name : orig.getResults().keySet()) {
> ResultConfig result = orig.getResults().get(name);
> @@ -125,7 +129,7 @@ public class ActionConfigMatcher extends
> .build();
> results.put(name, r);
> }
> -
> +
> List<ExceptionMappingConfig> exs = new
> ArrayList<ExceptionMappingConfig>();
> for (ExceptionMappingConfig ex : orig.getExceptionMappings()) {
> String name = convertParam(ex.getName(), vars);
> @@ -135,7 +139,7 @@ public class ActionConfigMatcher extends
> ExceptionMappingConfig e = new
> ExceptionMappingConfig.Builder(name, exClassName,
> exResult).addParams(exParams).build();
> exs.add(e);
> }
> -
> +
> return new ActionConfig.Builder(pkgName, orig.getName(), className)
> .methodName(methodName)
> .addParams(params)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]