You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pb...@apache.org on 2008/11/28 08:31:31 UTC

svn commit: r721367 - in /struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher: AbstractDispatcher.java servlet/ServletMappingDispatcher.java servlet/ServletParameterDispatcher.java

Author: pbenedict
Date: Thu Nov 27 23:31:30 2008
New Revision: 721367

URL: http://svn.apache.org/viewvc?rev=721367&view=rev
Log:
STR-3168: Bump buildArguments to root superclass

Modified:
    struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/AbstractDispatcher.java
    struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMappingDispatcher.java
    struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletParameterDispatcher.java

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/AbstractDispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/AbstractDispatcher.java?rev=721367&r1=721366&r2=721367&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/AbstractDispatcher.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/AbstractDispatcher.java Thu Nov 27 23:31:30 2008
@@ -20,6 +20,7 @@
  */
 package org.apache.struts.dispatcher;
 
+import org.apache.struts.action.Action;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.config.ActionConfig;
 import org.apache.struts.util.MessageResources;
@@ -88,6 +89,17 @@
 	methods = new HashMap();
     }
 
+    /**
+     * Constructs the arguments that will be passed to the dispatched method.
+     * 
+     * @param context the current action context
+     * @param method the target method of this dispatch
+     * 
+     * @return the arguments array
+     * @see #dispatchMethod(ActionContext, Method, String)
+     */
+    protected abstract Object[] buildMethodArguments(ActionContext context, Method method);
+
     public Object dispatch(ActionContext context) throws Exception {
 	// Resolve the method name; fallback to default if necessary
 	String methodName = resolveMethodName(context);
@@ -124,15 +136,21 @@
     }
 
     /**
-     * Dispatch to the specified method.
+     * Dispatches to the specified method.
      * 
      * @param context the current action context
      * @param method The method to invoke
      * @param name The name of the method to invoke
      * @return the return value of the method
      * @throws Exception if the dispatch fails with an exception
+     * @see #buildMethodArguments(ActionContext, Method)
      */
-    protected abstract Object dispatchMethod(ActionContext context, Method method, String name) throws Exception;
+    protected final Object dispatchMethod(ActionContext context, Method method, String name) throws Exception {
+	Action target = context.getAction();
+	String path = context.getActionConfig().getPath();
+	Object[] args = buildMethodArguments(context, method);
+	return invoke(target, method, args, path);
+    }
 
     /**
      * Empties the method cache.
@@ -242,8 +260,8 @@
     /**
      * Decides the appropriate method instance for the specified method name.
      * Implementations may introspect for any desired method signature. This
-     * resolution is only invoked if {@link #getMethod(ActionContext, String)} does not find a
-     * match in its method cache.
+     * resolution is only invoked if {@link #getMethod(ActionContext, String)}
+     * does not find a match in its method cache.
      * 
      * @param context the current action context
      * @param methodName the method name to use for introspection

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMappingDispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMappingDispatcher.java?rev=721367&r1=721366&r2=721367&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMappingDispatcher.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMappingDispatcher.java Thu Nov 27 23:31:30 2008
@@ -20,7 +20,6 @@
  */
 package org.apache.struts.dispatcher.servlet;
 
-import org.apache.struts.action.Action;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 import org.apache.struts.dispatcher.AbstractMappingDispatcher;
@@ -102,24 +101,8 @@
  */
 public class ServletMappingDispatcher extends AbstractMappingDispatcher {
 
-    /**
-     * Constructs the arguments that will be passed to the dispatched method.
-     * 
-     * @param context the current action context
-     * @param method the target method of this dispatch
-     * 
-     * @return the arguments array
-     * @see #dispatchMethod(ActionContext, Method, String)
-     */
-    protected Object[] buildMethodArguments(ServletActionContext context, Method method) {
-	return ServletDispatchUtils.buildClassicExecuteArguments(context);
-    }
-
-    protected final Object dispatchMethod(ActionContext context, Method method, String name) throws Exception {
-	Action target = context.getAction();
-	Object[] args = buildMethodArguments((ServletActionContext) context, method);
-	String path = context.getActionConfig().getPath();
-	return invoke(target, method, args, path);
+    protected Object[] buildMethodArguments(ActionContext context, Method method) {
+	return ServletDispatchUtils.buildClassicExecuteArguments((ServletActionContext) context);
     }
 
     protected Method resolveMethod(ActionContext context, String methodName) throws NoSuchMethodException {

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletParameterDispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletParameterDispatcher.java?rev=721367&r1=721366&r2=721367&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletParameterDispatcher.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletParameterDispatcher.java Thu Nov 27 23:31:30 2008
@@ -73,27 +73,8 @@
  */
 public class ServletParameterDispatcher extends AbstractParameterDispatcher {
 
-    /**
-     * Constructs the arguments that will be passed to the dispatched method.
-     * 
-     * @param context the current action context
-     * @param method the target method of this dispatch
-     * 
-     * @return the arguments array
-     * @see #dispatchMethod(ActionContext, Method, String)
-     */
-    protected Object[] buildMethodArguments(ServletActionContext context, Method method) {
-	return ServletDispatchUtils.buildClassicExecuteArguments(context);
-    }
-
-    /**
-     * @see #buildMethodArguments(ServletActionContext, Method)
-     */
-    protected final Object dispatchMethod(ActionContext context, Method method, String name) throws Exception {
-	Action target = context.getAction();
-	String path = context.getActionConfig().getPath();
-	Object[] args = buildMethodArguments((ServletActionContext) context, method);
-	return invoke(target, method, args, path);
+    protected Object[] buildMethodArguments(ActionContext context, Method method) {
+	return ServletDispatchUtils.buildClassicExecuteArguments((ServletActionContext) context);
     }
 
     protected Method resolveMethod(ActionContext context, String methodName) throws NoSuchMethodException {