You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2007/08/20 05:47:34 UTC
[jira] Updated: (STR-2365) DispatchAction method invocation
refactoring
[ https://issues.apache.org/struts/browse/STR-2365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Benedict updated STR-2365:
-------------------------------
Fix Version/s: 1.4.0
This will be a necessary enhancement to allow S2 like execute() invocations
> DispatchAction method invocation refactoring
> --------------------------------------------
>
> Key: STR-2365
> URL: https://issues.apache.org/struts/browse/STR-2365
> Project: Struts 1
> Issue Type: Improvement
> Components: Extras
> Affects Versions: Nightly Build
> Environment: Operating System: Windows XP
> Platform: PC
> Reporter: Jason Menard
> Priority: Minor
> Fix For: 1.4.0
>
> Attachments: DispatchAction.java, DispatchAction.java, DispatchActionInvokeMethod.txt
>
>
> A common pattern in Struts is to apply the template method design pattern to
> create a base action for one's application, as discussed in
> StrutsCatalogBaseAction in the Struts wiki
> (http://wiki.apache.org/struts/StrutsCatalogBaseAction). Occasionally,
> developers may wish to use an alternate method signature. While this is no
> problem with Action, it is more problematic with DispatchAction and its
> subclasses. I would like to propose a minor refactoring of DispatchAction in
> order to facilitate this.
> The refactoring consists of extracting two lines from dispatchMethod() into a
> new method protected call invokeMethod().
> The original code from dispatchMethod():
> Object args[] = {mapping, form, request, response};
> forward = (ActionForward) method.invoke(this, args);
> Refactored dispatchMethod():
> forward = invokeMethod(mapping, form, request, response, method);
> And the new method:
> protected ActionForward invokeMethod(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response,
> Method method)
> throws Exception {
> Object args[] = {mapping, form, request, response};
> ActionForward forward = (ActionForward) method.invoke(this, args);
> return forward;
> }
> Applying this refactoring will allow the developer to more easily extend
> DispatchAction in order to allow for alternate method signatures.
> I will attach a patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.