You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Bob Tiernay (JIRA)" <ji...@apache.org> on 2007/11/15 03:09:34 UTC

[jira] Created: (WW-2323) ActionComponent does not respect struts.enable.DynamicMethodInvocation=false

ActionComponent does not respect struts.enable.DynamicMethodInvocation=false
----------------------------------------------------------------------------

                 Key: WW-2323
                 URL: https://issues.apache.org/struts/browse/WW-2323
             Project: Struts 2
          Issue Type: Bug
          Components: Core Actions
    Affects Versions: 2.0.9
         Environment: Windows XP SP2, Tomcat
            Reporter: Bob Tiernay


<s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
org.apache.struts2.components.ActionComponent's executeAction method:

...

        // handle "name!method" convention.
        final String actionName;
        final String methodName;

        int exclamation = actualName.lastIndexOf("!");
        if (exclamation != -1) {
            actionName = actualName.substring(0, exclamation);
            methodName = actualName.substring(exclamation + 1);
        } else {
            actionName = actualName;
            methodName = null;
        }

...

Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.

This bug appears to be the result of an incomplete backwards compatibility support, added to enbale the old webwork ! convention. This was a notable change documented here:

http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html

The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.

(See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2323) ActionComponent does not respect struts.enable.DynamicMethodInvocation=false

Posted by "Bob Tiernay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Tiernay updated WW-2323:
----------------------------

    Description: 
<s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
org.apache.struts2.components.ActionComponent's executeAction method:

...

        // handle "name!method" convention.
        final String actionName;
        final String methodName;

        int exclamation = actualName.lastIndexOf("!");
        if (exclamation != -1) {
            actionName = actualName.substring(0, exclamation);
            methodName = actualName.substring(exclamation + 1);
        } else {
            actionName = actualName;
            methodName = null;
        }

...

Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.

This bug appears to be the result of an incomplete backwards compatibility support, added to enable the old webwork ! convention. This was a notable change documented here:

http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html

The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.

(See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)



  was:
<s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
org.apache.struts2.components.ActionComponent's executeAction method:

...

        // handle "name!method" convention.
        final String actionName;
        final String methodName;

        int exclamation = actualName.lastIndexOf("!");
        if (exclamation != -1) {
            actionName = actualName.substring(0, exclamation);
            methodName = actualName.substring(exclamation + 1);
        } else {
            actionName = actualName;
            methodName = null;
        }

...

Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.

This bug appears to be the result of an incomplete backwards compatibility support, added to enbale the old webwork ! convention. This was a notable change documented here:

http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html

The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.

(See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)




> ActionComponent does not respect struts.enable.DynamicMethodInvocation=false
> ----------------------------------------------------------------------------
>
>                 Key: WW-2323
>                 URL: https://issues.apache.org/struts/browse/WW-2323
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9
>         Environment: Windows XP SP2, Tomcat
>            Reporter: Bob Tiernay
>
> <s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
> org.apache.struts2.components.ActionComponent's executeAction method:
> ...
>         // handle "name!method" convention.
>         final String actionName;
>         final String methodName;
>         int exclamation = actualName.lastIndexOf("!");
>         if (exclamation != -1) {
>             actionName = actualName.substring(0, exclamation);
>             methodName = actualName.substring(exclamation + 1);
>         } else {
>             actionName = actualName;
>             methodName = null;
>         }
> ...
> Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.
> This bug appears to be the result of an incomplete backwards compatibility support, added to enable the old webwork ! convention. This was a notable change documented here:
> http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html
> The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.
> (See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-2323) ActionComponent does not respect struts.enable.DynamicMethodInvocation=false

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2323.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

Fixed by adding a new method to ActionMapper for parsing action names, and delegated the parsing to it.  Thanks for the fancy patch though :)

> ActionComponent does not respect struts.enable.DynamicMethodInvocation=false
> ----------------------------------------------------------------------------
>
>                 Key: WW-2323
>                 URL: https://issues.apache.org/struts/browse/WW-2323
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9
>         Environment: Windows XP SP2, Tomcat
>            Reporter: Bob Tiernay
>            Assignee: Don Brown
>             Fix For: 2.1.1
>
>         Attachments: struts2-WW-2323.patch
>
>
> <s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
> org.apache.struts2.components.ActionComponent's executeAction method:
> ...
>         // handle "name!method" convention.
>         final String actionName;
>         final String methodName;
>         int exclamation = actualName.lastIndexOf("!");
>         if (exclamation != -1) {
>             actionName = actualName.substring(0, exclamation);
>             methodName = actualName.substring(exclamation + 1);
>         } else {
>             actionName = actualName;
>             methodName = null;
>         }
> ...
> Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.
> This bug appears to be the result of an incomplete backwards compatibility support, added to enable the old webwork ! convention. This was a notable change documented here:
> http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html
> The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.
> (See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2323) ActionComponent does not respect struts.enable.DynamicMethodInvocation=false

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes Wannemacher updated WW-2323:
--------------------------------

    Attachment: struts2-WW-2323.patch

I took a look at this issue and thought a patch would be easy enough to generate, but the more I thought about it, I thought that a person using this tag might expect more than what it currently does. This patch attempts to use the current action mapper to resolve the best namespace/action/method combo to execute. I'm open to feedback on this because it is a big-time hack and I was actually surprised when the unit tests all passed. 

> ActionComponent does not respect struts.enable.DynamicMethodInvocation=false
> ----------------------------------------------------------------------------
>
>                 Key: WW-2323
>                 URL: https://issues.apache.org/struts/browse/WW-2323
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9
>         Environment: Windows XP SP2, Tomcat
>            Reporter: Bob Tiernay
>         Attachments: struts2-WW-2323.patch
>
>
> <s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
> org.apache.struts2.components.ActionComponent's executeAction method:
> ...
>         // handle "name!method" convention.
>         final String actionName;
>         final String methodName;
>         int exclamation = actualName.lastIndexOf("!");
>         if (exclamation != -1) {
>             actionName = actualName.substring(0, exclamation);
>             methodName = actualName.substring(exclamation + 1);
>         } else {
>             actionName = actualName;
>             methodName = null;
>         }
> ...
> Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.
> This bug appears to be the result of an incomplete backwards compatibility support, added to enable the old webwork ! convention. This was a notable change documented here:
> http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html
> The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.
> (See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2323) ActionComponent does not respect struts.enable.DynamicMethodInvocation=false

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43067#action_43067 ] 

Don Brown commented on WW-2323:
-------------------------------

What cases would this patch not work for?  Looking at it, I had some minor changes (never use Dispatcher.getInstance(), have your object injected instead), but otherwise, I thought it was an interesting way to ensure the action/method resolution code happens in one place, something that always bothered me about the action tag.

> ActionComponent does not respect struts.enable.DynamicMethodInvocation=false
> ----------------------------------------------------------------------------
>
>                 Key: WW-2323
>                 URL: https://issues.apache.org/struts/browse/WW-2323
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.9
>         Environment: Windows XP SP2, Tomcat
>            Reporter: Bob Tiernay
>             Fix For: 2.1.1
>
>         Attachments: struts2-WW-2323.patch
>
>
> <s:action name="xxx!yyy"> will always attempt to find an action with name "xxx" and invoke it's method "yyy".  This is a result of 
> org.apache.struts2.components.ActionComponent's executeAction method:
> ...
>         // handle "name!method" convention.
>         final String actionName;
>         final String methodName;
>         int exclamation = actualName.lastIndexOf("!");
>         if (exclamation != -1) {
>             actionName = actualName.substring(0, exclamation);
>             methodName = actualName.substring(exclamation + 1);
>         } else {
>             actionName = actualName;
>             methodName = null;
>         }
> ...
> Note that the first branch in the if statement is *not* correct behavior in the case that struts.enable.DynamicMethodInvocation has been set to false in struts.properties.
> This bug appears to be the result of an incomplete backwards compatibility support, added to enable the old webwork ! convention. This was a notable change documented here:
> http://struts.apache.org/2.x/docs/key-changes-from-webwork-2.html
> The proposed solution is to respect the value struts.enable.DynamicMethodInvocation in ActionComponent so that both values of true and false can be used consistently across the framework.
> (See also Form component and ServletUrlRenderer for their use of struts.enable.DynamicMethodInvocation)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.