You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/05/05 05:35:12 UTC

[jira] [Commented] (WW-4596) Strict DMI causes This method: for action is not allowed!

    [ https://issues.apache.org/jira/browse/WW-4596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15271907#comment-15271907 ] 

ASF subversion and git services commented on WW-4596:
-----------------------------------------------------

Commit 02b207fca529627f3a34660de86b51444461a7d2 in struts's branch refs/heads/master from [~lukaszlenart]
[ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=02b207f ]

WW-4596 Allows redefine regex used to match methods when SMI is disabled


> Strict DMI causes This method: for action is not allowed!  
> -----------------------------------------------------------
>
>                 Key: WW-4596
>                 URL: https://issues.apache.org/jira/browse/WW-4596
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.5
>            Reporter: Greg Huber
>             Fix For: 2.5
>
>         Attachments: struts.patch
>
>
> I have tried adding
> {code:xml}
> <global-allowed-methods>execute,input,cancel</global-allowed-methods>
> {code}
> and get
> {noformat}
> This method: cancel for action eventAdd is not allowed! - [unknown location]
> {noformat}
> {code:xml}
> <action name="eventAdd!*" method="{1}"
>                 class="ui.struts2.editor.EventAdd">
>             <result name="input" type="tiles">.EventAdd</result>
>             <result name="success" type="chain">eventEdit</result>
>             <result name="cancel" type="redirectAction">
>                 <param name="actionName">memberEvents</param>
>                 <param name="pgn">${bean.pageNum}</param>
>                 <param name="suppressEmptyParameters">true</param>
>             </result>
>         </action>
> {code}
> checking ActionConfig:
> {code:java}
> public boolean isAllowedMethod(String method) {
>         return method.equals(methodName != null ? methodName : DEFAULT_METHOD) || allowedMethods.isAllowed(method);
>     }
> {code}
> Debugging  I get a calls to isAllowedMethod with :
> {noformat}
> 1 methodName = {1}​ and method = execute
> 2 methodName = execute and method = cancel
> {noformat}
> ​Only #1 has the required cancel
> #2 there is only a {{\[LiteralAllowedMethod\{allowedMethod='execute'\}\]}}
> On further investigation {{com.opensymphony.xwork2.config.implActionConfigMatcher}} seems to create a new ActionConfig but then only uses the default allowed names:
> {code:java}
> return new ActionConfig.Builder(pkgName, orig.getName(), className)
>                 .methodName(methodName)
>                 .addParams(params)
>                 .addResultConfigs(results)
>                 .addInterceptors(orig.getInterceptors())
>                 .addExceptionMappings(exs)
>                 .location(orig.getLocation())
>                 .build();
> {code}
> Could use the original by appending .addAllowedMethod(orig.getAllowedMethods()), but I guess it should come from the ActionConfig stored in the packageContext or wherever the orig object gets its allowedMethods from.
> Cheers Greg



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)