You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2006/05/07 08:58:53 UTC
[jira] Updated: (STR-2365) DispatchAction method invocation
refactoring
[ http://issues.apache.org/struts/browse/STR-2365?page=all ]
Don Brown updated STR-2365:
---------------------------
Bugzilla Id: (was: 33573)
Component: Extras
(was: Core)
Assign To: (was: Struts Developer Mailing List)
> DispatchAction method invocation refactoring
> --------------------------------------------
>
> Key: STR-2365
> URL: http://issues.apache.org/struts/browse/STR-2365
> Project: Struts Action 1
> Type: Improvement
> Components: Extras
> Versions: Nightly Build
> Environment: Operating System: Windows XP
> Platform: PC
> Reporter: Jason Menard
> Priority: Minor
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira