You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonius Ng <an...@gmail.com> on 2009/09/25 04:25:47 UTC

DefaultActionInvocation invokeAction

Hi all,

The following code is extracted from xwork source
DefaultActionInvocation.java and rest-plugin RestActionInvocation.java:

protected String invokeAction(Object action, ActionConfig actionConfig)
throws Exception {
        String methodName = proxy.getMethod();

        if (LOG.isDebugEnabled()) {
            LOG.debug("Executing action method = " +
actionConfig.getMethodName());
        }
...
 method = getAction().getClass().getMethod(methodName, new Class[0]);
...

Is there any reason why the log is debugging actionConfig.getMethodName()
while the one being used is from proxy.getMethod()? I don't see anywhere in
the code where actionConfig.getMethodName() is being used.

The reason I am asking this is also because I found out that:
1. for actions written in struts.xml <action> tag,
actionConfig.getMethodName() returns the method of the action as specified
in struts.xml
2. for controllers autoconfigured by rest-plugin,
actionConfig.getMethodName() returns null
3. I can have both controllers and actions defined with <action> tag working
together, with the following simple changes:
protected String invokeAction(Object action, ActionConfig actionConfig)
throws Exception {
        String methodName =
(actionConfig.getMethodName()==null)?proxy.getMethod():actionConfig.getMethodName();

Thanks in advance.

Regards,
Anton