rleland 2003/08/13 10:19:58
Modified: src/share/org/apache/struts/actions DispatchAction.java
LocalStrings.properties MappingDispatchAction.java
Log:
Bug#: 18002 Patches again provided by Leonardo Quijano
Also refactor MappingDispatchAction so it is consistent with
other XXXDispatchActions with new method getMethodName.
Thanks.
Revision Changes Path
1.19 +5 -6
jakarta-struts/src/share/org/apache/struts/actions/DispatchAction.java
Index: DispatchAction.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/DispatchAction.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DispatchAction.java 13 Aug 2003 05:29:27 -0000 1.18
+++ DispatchAction.java 13 Aug 2003 17:19:58 -0000 1.19
@@ -260,8 +260,7 @@
/**
* Method which is dispatched to when the request is a cancel button submit.
* Subclasses of <code>DispatchAction</code> should override this method if
- * they wish to provide default behavior different than throwing a
- * ServletException.
+ * they wish to provide default behavior different than returning null.
* @since Struts 1.2.1
*/
protected ActionForward cancelled(ActionMapping mapping,
1.9 +0 -1
jakarta-struts/src/share/org/apache/struts/actions/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/LocalStrings.properties,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LocalStrings.properties 13 Aug 2003 04:53:43 -0000 1.8
+++ LocalStrings.properties 13 Aug 2003 17:19:58 -0000 1.9
@@ -1,4 +1,3 @@
-dispatch.cancelled=Action[{0}] does not contain a cancel handler
dispatch.error=Dispatch[{0}] to method '{1}' returned an exception
dispatch.handler=DispatchMapping[{0}] does not define a handler property
dispatch.lookup=Action[{0}] does not contain handler for resource '{1}'
1.4 +32 -13
jakarta-struts/src/share/org/apache/struts/actions/MappingDispatchAction.java
Index: MappingDispatchAction.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/MappingDispatchAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MappingDispatchAction.java 12 Aug 2003 14:13:13 -0000 1.3
+++ MappingDispatchAction.java 13 Aug 2003 17:19:58 -0000 1.4
@@ -165,6 +165,7 @@
* @author Ted Husted
* @author Anthony Kay
* @author Steve Raeburn
+ * @author Leonardo Quijano
* @version $Revision$ $Date$
* @since Struts 1.2
*/
@@ -212,15 +213,9 @@
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
-
- // Identify the method name to be dispatched to
- String name = mapping.getParameter();
- if (name == null) {
- return unspecified(mapping, form, request, response);
- }
-
- // Invoke the named method, and return the result
- return dispatchMethod(mapping, form, request, response, name);
+
+ // Use the overridden getMethodName.
+ return super.execute(mapping, form, request, response);
}
@@ -256,5 +251,29 @@
throw new ServletException(message);
}
+
+ /**
+ * Returns the method name, given a parameter's value.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The HTTP request we are processing
+ * @param response The HTTP response we are creating
+ * @param parameter The <code>ActionMapping</code> parameter's name
+ *
+ * @return The method's name.
+ * @since Struts 1.2.1
+ */
+ protected String getMethodName(
+ ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response,
+ String parameter)
+ throws Exception {
+
+ // Return the unresolved mapping parameter.
+ return parameter;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]