You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ma...@apache.org on 2005/05/15 03:27:05 UTC
svn commit: r170188 - in
/struts/core/trunk/src/share/org/apache/struts/actions:
ActionDispatcher.java BaseAction.java ChainAction.java DispatchAction.java
DispatchChainAction.java DownloadAction.java ForwardAction.java
IncludeAction.java LocaleAction.java LookupDispatchAction.java
MappingDispatchAction.java SwitchAction.java
Author: martinc
Date: Sat May 14 18:27:02 2005
New Revision: 170188
URL: http://svn.apache.org/viewcvs?rev=170188&view=rev
Log:
More Checkstyle fixes.
Modified:
struts/core/trunk/src/share/org/apache/struts/actions/ActionDispatcher.java
struts/core/trunk/src/share/org/apache/struts/actions/BaseAction.java
struts/core/trunk/src/share/org/apache/struts/actions/ChainAction.java
struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java
struts/core/trunk/src/share/org/apache/struts/actions/DispatchChainAction.java
struts/core/trunk/src/share/org/apache/struts/actions/DownloadAction.java
struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java
struts/core/trunk/src/share/org/apache/struts/actions/IncludeAction.java
struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java
struts/core/trunk/src/share/org/apache/struts/actions/LookupDispatchAction.java
struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java
struts/core/trunk/src/share/org/apache/struts/actions/SwitchAction.java
Modified: struts/core/trunk/src/share/org/apache/struts/actions/ActionDispatcher.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/ActionDispatcher.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/ActionDispatcher.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/ActionDispatcher.java Sat May 14 18:27:02 2005
@@ -36,15 +36,16 @@
import org.apache.struts.Globals;
/**
- * <p>Action <i>helper</i> class that dispatches to a public method in an Action.</p>
+ * <p>Action <i>helper</i> class that dispatches to a public method in an
+ * Action.</p>
* <p/>
* <p>This class is provided as an alternative mechanism to using DispatchAction
* and its various flavours and means <i>Dispatch</i> behaviour can be
* easily implemented into any <code>Action</code> without having to
* inherit from a particular super <code>Action</code>.</p>
* <p/>
- * <p>To implement <i>dispatch</i> behaviour</i> in an <code>Action</code> class,
- * create your custom Action as follows, along with the methods you
+ * <p>To implement <i>dispatch</i> behaviour in an <code>Action</code>
+ * class, create your custom Action as follows, along with the methods you
* require (and optionally "cancelled" and "unspecified" methods):</p>
* <p/>
* <pre>
@@ -66,24 +67,24 @@
* <p>It provides three flavours of determing the name of the method:</p>
* <p/>
* <ul>
- * <li><strong>{@link #DEFAULT_FLAVOR}</strong> - uses the parameter specified in
- * the struts-config.xml to get the method name from the Request
+ * <li><strong>{@link #DEFAULT_FLAVOR}</strong> - uses the parameter specified
+ * in the struts-config.xml to get the method name from the Request
* (equivalent to <code>DispatchAction</code> <b>except</b> uses "method"
* as a default if the <code>parameter</code> is not specified
* in the struts-config.xml).</li>
* <p/>
- * <li><strong>{@link #DISPATCH_FLAVOR}</strong> - uses the parameter specified in
- * the struts-config.xml to get the method name from the Request
+ * <li><strong>{@link #DISPATCH_FLAVOR}</strong> - uses the parameter specified
+ * in the struts-config.xml to get the method name from the Request
* (equivalent to <code>DispatchAction</code>).</li>
* <p/>
- * <li><strong>{@link #MAPPING_FLAVOR}</strong> - uses the parameter specified in
- * the struts-config.xml as the method name
+ * <li><strong>{@link #MAPPING_FLAVOR}</strong> - uses the parameter specified
+ * in the struts-config.xml as the method name
* (equivalent to <code>MappingDispatchAction</code>).</li>
* <p/>
* </ul>
*
* @since Struts 1.2.7
- * @version $Revision$ $Date$
+ * @version $Rev$ $Date$
*/
public class ActionDispatcher {
@@ -91,17 +92,17 @@
// ----------------------------------------------------- Instance Variables
/**
- * Indicates "default" dispatch flavor
+ * Indicates "default" dispatch flavor.
*/
public static final int DEFAULT_FLAVOR = 0;
/**
- * Indicates "mapping" dispatch flavor
+ * Indicates "mapping" dispatch flavor.
*/
public static final int MAPPING_FLAVOR = 1;
/**
- * Indicates flavor compatible with DispatchAction
+ * Indicates flavor compatible with DispatchAction.
*/
public static final int DISPATCH_FLAVOR = 2;
@@ -112,7 +113,7 @@
protected Action actionInstance;
/**
- * Indicates dispatch <i>flavor</i>
+ * Indicates dispatch <i>flavor</i>.
*/
protected int flavor;
@@ -155,11 +156,22 @@
// ----------------------------------------------------- Constructors
+ /**
+ * Construct an instance of this class from the supplied parameters.
+ *
+ * @param actionInstance The action instance to be invoked.
+ */
public ActionDispatcher(Action actionInstance) {
this(actionInstance, DEFAULT_FLAVOR);
}
+ /**
+ * Construct an instance of this class from the supplied parameters.
+ *
+ * @param actionInstance The action instance to be invoked.
+ * @param flavor The flavor of dispatch to use.
+ */
public ActionDispatcher(Action actionInstance, int flavor) {
this.actionInstance = actionInstance;
@@ -184,6 +196,10 @@
* @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
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
* @throws Exception if an exception occurs
*/
public ActionForward execute(ActionMapping mapping,
@@ -203,13 +219,14 @@
String parameter = getParameter(mapping, form, request, response);
// Get the method's name. This could be overridden in subclasses.
- String name = getMethodName(mapping, form, request, response, parameter);
+ String name = getMethodName(mapping, form, request, response,
+ parameter);
// Prevent recursive calls
if ("execute".equals(name) || "perform".equals(name)) {
- String message =
- messages.getMessage("dispatch.recursive", mapping.getPath());
+ String message = messages.getMessage("dispatch.recursive",
+ mapping.getPath());
log.error(message);
throw new ServletException(message);
@@ -227,7 +244,18 @@
* if present, otherwise throws a ServletException. Classes utilizing
* <code>ActionDispatcher</code> should provide an <code>unspecified</code>
* method if they wish to provide behavior different than
- * throwing a ServletException..</p>
+ * throwing a ServletException.</p>
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
*/
protected ActionForward unspecified(ActionMapping mapping,
ActionForm form,
@@ -261,6 +289,17 @@
* otherwise returns null. Classes utilizing <code>ActionDispatcher</code>
* should provide a <code>cancelled</code> method if they wish to provide
* behavior different than returning null.</p>
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
*/
protected ActionForward cancelled(ActionMapping mapping,
ActionForm form,
@@ -287,6 +326,18 @@
/**
* Dispatch to the specified method.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ * @param name The name of the method to invoke
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
*/
protected ActionForward dispatchMethod(ActionMapping mapping,
ActionForm form,
@@ -306,8 +357,8 @@
method = getMethod(name);
} catch (NoSuchMethodException e) {
- String message =
- messages.getMessage("dispatch.method", mapping.getPath(), name);
+ String message = messages.getMessage("dispatch.method",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
}
@@ -318,6 +369,19 @@
/**
* Dispatch to the specified method.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ * @param name The name of the method to invoke
+ * @param method The method to invoke
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
*/
protected ActionForward dispatchMethod(ActionMapping mapping,
ActionForm form,
@@ -328,18 +392,18 @@
ActionForward forward = null;
try {
- Object args[] = {mapping, form, request, response};
+ Object[] args = {mapping, form, request, response};
forward = (ActionForward) method.invoke(actionInstance, args);
} catch (ClassCastException e) {
- String message =
- messages.getMessage("dispatch.return", mapping.getPath(), name);
+ String message = messages.getMessage("dispatch.return",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
} catch (IllegalAccessException e) {
- String message =
- messages.getMessage("dispatch.error", mapping.getPath(), name);
+ String message = messages.getMessage("dispatch.error",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
@@ -350,8 +414,8 @@
if (t instanceof Exception) {
throw ((Exception) t);
} else {
- String message =
- messages.getMessage("dispatch.error", mapping.getPath(), name);
+ String message = messages.getMessage("dispatch.error",
+ mapping.getPath(), name);
log.error(message, e);
throw new ServletException(t);
}
@@ -368,6 +432,7 @@
* method does.
*
* @param name Name of the method to be introspected
+ * @return The method with the specified name.
* @throws NoSuchMethodException if no such method can be found
*/
protected Method getMethod(String name)
@@ -393,6 +458,7 @@
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @return The <code>ActionMapping</code> parameter's value
+ * @throws Exception if an error occurs.
*/
protected String getParameter(ActionMapping mapping,
ActionForm form,
@@ -410,8 +476,8 @@
return "method";
}
- if ((parameter == null) &&
- ((flavor == MAPPING_FLAVOR || flavor == DISPATCH_FLAVOR))) {
+ if ((parameter == null)
+ && ((flavor == MAPPING_FLAVOR || flavor == DISPATCH_FLAVOR))) {
String message =
messages.getMessage("dispatch.handler", mapping.getPath());
@@ -433,6 +499,7 @@
* @param response The HTTP response we are creating
* @param parameter The <code>ActionMapping</code> parameter's name
* @return The method's name.
+ * @throws Exception if an error occurs.
*/
protected String getMethodName(ActionMapping mapping,
ActionForm form,
@@ -461,6 +528,10 @@
* will have been skipped by the controller servlet.</p>
*
* @param request The servlet request we are processing
+ *
+ * @return <code>true</code> if the current form's cancel button was
+ * pressed; <code>false</code> otherwise.
+ *
* @see org.apache.struts.taglib.html.CancelTag
*/
protected boolean isCancelled(HttpServletRequest request) {
Modified: struts/core/trunk/src/share/org/apache/struts/actions/BaseAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/BaseAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/BaseAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/BaseAction.java Sat May 14 18:27:02 2005
@@ -36,8 +36,9 @@
/**
* The message resources for this package.
*/
- protected static MessageResources messages = MessageResources.getMessageResources
- ("org.apache.struts.actions.LocalStrings");
+ protected static MessageResources messages =
+ MessageResources.getMessageResources(
+ "org.apache.struts.actions.LocalStrings");
}
Modified: struts/core/trunk/src/share/org/apache/struts/actions/ChainAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/ChainAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/ChainAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/ChainAction.java Sat May 14 18:27:02 2005
@@ -1,4 +1,6 @@
/*
+ * $Id: ChainAction.java 54929 2004-10-16 16:38:42Z germuska $
+ *
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -90,6 +92,11 @@
* @param form <code>ActionForm</code> for this request (if any)
* @param request <code>HttpServletRequest</code> we are processing
* @param response <code>HttpServletResponse</code> we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if an exception occurs
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
@@ -135,6 +142,8 @@
* <p>Return the <code>Catalog</code> we will use to acquire the
* <code>Command</code> to be executed. NOTE: Any race condition
* calling this method is harmless, so do not bother to synchronize.</p>
+ *
+ * @return The catalog in which to look up commands.
*/
protected Catalog getCatalog() {
Modified: struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java Sat May 14 18:27:02 2005
@@ -80,10 +80,11 @@
*
* <p><strong>NOTE</strong> - If the value of the request parameter is empty,
* a method named <code>unspecified</code> is called. The default action is
- * to throw an exception. If the request was cancelled (a <code>html:cancel</code>
- * button was pressed), the custom handler <code>cancelled</code> will be used instead.
- * You can also override the <code>getMethodName</code> method to override the action's
- * default handler selection.</p>
+ * to throw an exception. If the request was cancelled (a
+ * <code>html:cancel</code> button was pressed), the custom handler
+ * <code>cancelled</code> will be used instead. You can also override the
+ * <code>getMethodName</code> method to override the action's default handler
+ * selection.</p>
*
* @version $Rev$ $Date$
*/
@@ -142,6 +143,9 @@
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
* @exception Exception if an exception occurs
*/
public ActionForward execute(ActionMapping mapping,
@@ -158,8 +162,8 @@
// Identify the request parameter containing the method name
String parameter = mapping.getParameter();
if (parameter == null) {
- String message =
- messages.getMessage("dispatch.handler", mapping.getPath());
+ String message = messages.getMessage("dispatch.handler",
+ mapping.getPath());
log.error(message);
@@ -167,7 +171,8 @@
}
// Get the method's name. This could be overridden in subclasses.
- String name = getMethodName(mapping, form, request, response, parameter);
+ String name = getMethodName(mapping, form, request, response,
+ parameter);
// Prevent recursive calls
@@ -193,6 +198,17 @@
* request parameter included in the request. Subclasses of
* <code>DispatchAction</code> should override this method if they wish
* to provide default behavior different than throwing a ServletException.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
*/
protected ActionForward unspecified(
ActionMapping mapping,
@@ -216,6 +232,18 @@
* 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 returning null.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
+ *
* @since Struts 1.2.0
*/
protected ActionForward cancelled(ActionMapping mapping,
@@ -232,6 +260,19 @@
/**
* Dispatch to the specified method.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The non-HTTP request we are processing
+ * @param response The non-HTTP response we are creating
+ * @param name The name of the method to invoke
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if the application business logic throws an
+ * exception.
+ *
* @since Struts 1.1
*/
protected ActionForward dispatchMethod(ActionMapping mapping,
@@ -251,39 +292,39 @@
try {
method = getMethod(name);
- } catch(NoSuchMethodException e) {
- String message =
- messages.getMessage("dispatch.method", mapping.getPath(), name);
+ } catch (NoSuchMethodException e) {
+ String message = messages.getMessage("dispatch.method",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
}
ActionForward forward = null;
try {
- Object args[] = {mapping, form, request, response};
+ Object[] args = {mapping, form, request, response};
forward = (ActionForward) method.invoke(this, args);
- } catch(ClassCastException e) {
- String message =
- messages.getMessage("dispatch.return", mapping.getPath(), name);
+ } catch (ClassCastException e) {
+ String message = messages.getMessage("dispatch.return",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
- } catch(IllegalAccessException e) {
- String message =
- messages.getMessage("dispatch.error", mapping.getPath(), name);
+ } catch (IllegalAccessException e) {
+ String message = messages.getMessage("dispatch.error",
+ mapping.getPath(), name);
log.error(message, e);
throw e;
- } catch(InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
// Rethrow the target exception if possible so that the
// exception handling machinery can deal with it
Throwable t = e.getTargetException();
if (t instanceof Exception) {
throw ((Exception) t);
} else {
- String message =
- messages.getMessage("dispatch.error", mapping.getPath(), name);
+ String message = messages.getMessage("dispatch.error",
+ mapping.getPath(), name);
log.error(message, e);
throw new ServletException(t);
}
@@ -301,12 +342,14 @@
*
* @param name Name of the method to be introspected
*
+ * @return The method with the specified name.
+ *
* @exception NoSuchMethodException if no such method can be found
*/
protected Method getMethod(String name)
throws NoSuchMethodException {
- synchronized(methods) {
+ synchronized (methods) {
Method method = (Method) methods.get(name);
if (method == null) {
method = clazz.getMethod(name, types);
@@ -327,6 +370,9 @@
* @param parameter The <code>ActionMapping</code> parameter's name
*
* @return The method's name.
+ *
+ * @throws Exception if an error occurs.
+ *
* @since Struts 1.2.0
*/
protected String getMethodName(ActionMapping mapping,
Modified: struts/core/trunk/src/share/org/apache/struts/actions/DispatchChainAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/DispatchChainAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/DispatchChainAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/DispatchChainAction.java Sat May 14 18:27:02 2005
@@ -1,4 +1,6 @@
/*
+ * $Id: DispatchChainAction.java 54929 2004-10-16 16:38:42Z germuska $
+ *
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -89,6 +91,11 @@
* @param form <code>ActionForm</code> for this request (if any)
* @param request <code>HttpServletRequest</code> we are processing
* @param response <code>HttpServletResponse</code> we are creating
+ *
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
+ * @exception Exception if an exception occurs
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
@@ -135,6 +142,8 @@
* <p>Return the <code>Catalog</code> we will use to acquire the
* <code>Command</code> to be executed. NOTE: Any race condition
* calling this method is harmless, so do not bother to synchronize.</p>
+ *
+ * @return The catalog in which to look up commands.
*/
protected Catalog getCatalog() {
Modified: struts/core/trunk/src/share/org/apache/struts/actions/DownloadAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/DownloadAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/DownloadAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/DownloadAction.java Sat May 14 18:27:02 2005
@@ -53,7 +53,7 @@
* the buffer size that will be used to transfer the data to the servlet
* output stream.
*/
- protected static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+ protected static final int DEFAULT_BUFFER_SIZE = 4096;
/**
* Returns the information on the file, or other stream, to be downloaded
@@ -96,6 +96,9 @@
* @param request The HTTP request we are processing.
* @param response The HTTP response we are creating.
*
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
* @throws Exception if an exception occurs.
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
@@ -153,15 +156,17 @@
*
* @return The content type of the stream.
*/
- public abstract String getContentType();
+ String getContentType();
/**
* Returns an input stream on the content to be downloaded. This stream
* will be closed by the <code>DownloadAction</code>.
*
* @return The input stream for the content to be downloaded.
+ *
+ * @throws IOException if an error occurs
*/
- public abstract InputStream getInputStream() throws IOException;
+ InputStream getInputStream() throws IOException;
}
/**
@@ -206,6 +211,8 @@
* will be closed by the <code>DownloadAction</code>.
*
* @return The input stream for the file to be downloaded.
+ *
+ * @throws IOException if an error occurs
*/
public InputStream getInputStream() throws IOException {
FileInputStream fis = new FileInputStream(file);
@@ -264,6 +271,8 @@
* will be closed by the <code>DownloadAction</code>.
*
* @return The input stream for the resource to be downloaded.
+ *
+ * @throws IOException if an error occurs
*/
public InputStream getInputStream() throws IOException {
return context.getResourceAsStream(path);
Modified: struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/ForwardAction.java Sat May 14 18:27:02 2005
@@ -69,6 +69,9 @@
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
* @exception Exception if an error occurs
*/
public ActionForward execute(
Modified: struts/core/trunk/src/share/org/apache/struts/actions/IncludeAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/IncludeAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/IncludeAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/IncludeAction.java Sat May 14 18:27:02 2005
@@ -71,6 +71,9 @@
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
+ * @return The forward to which control should be transferred, or
+ * <code>null</code> if the response has been completed.
+ *
* @exception Exception if an error occurs
*/
public ActionForward execute(
Modified: struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/LocaleAction.java Sat May 14 18:27:02 2005
@@ -32,7 +32,6 @@
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.DynaActionForm;
/**
@@ -45,8 +44,9 @@
/**
* Commons Logging instance.
- */
- private Log log = LogFactory.getFactory().getInstance(this.getClass().getName());
+ */
+ private Log log = LogFactory.getFactory().getInstance(
+ this.getClass().getName());
/**
* <p>
@@ -73,7 +73,7 @@
* @param response The HTTP response we are creating
*
* @return Action to forward to
- * @exception java.lang.Exception if an input/output error or servlet exception occurs
+ * @exception Exception if an input/output error or servlet exception occurs
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
Modified: struts/core/trunk/src/share/org/apache/struts/actions/LookupDispatchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/LookupDispatchAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/LookupDispatchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/LookupDispatchAction.java Sat May 14 18:27:02 2005
@@ -96,8 +96,8 @@
* // do delete
* return mapping.findForward("success");
* }
- * <p>
- *
+ * </pre>
+ * <p>
* <strong>Notes</strong> - If duplicate values exist for the keys returned by
* getKeys, only the first one found will be returned. If no corresponding key
* is found then an exception will be thrown. You can override the
@@ -150,21 +150,28 @@
// Identify the request parameter containing the method name
String parameter = mapping.getParameter();
if (parameter == null) {
- String message = messages.getMessage("dispatch.handler", mapping.getPath());
+ String message = messages.getMessage("dispatch.handler",
+ mapping.getPath());
throw new ServletException(message);
}
// Identify the string to lookup
- String methodName = getMethodName(mapping, form, request, response, parameter);
+ String methodName = getMethodName(mapping, form, request, response,
+ parameter);
return dispatchMethod(mapping, form, request, response, methodName);
}
/**
- * This is the first time this Locale is used so build the reverse lookup Map.
- * Search for message keys in all configured MessageResources for
+ * This is the first time this Locale is used so build the reverse lookup
+ * Map. Search for message keys in all configured MessageResources for
* the current module.
+ *
+ * @param request The HTTP request we are processing
+ * @param userLocale The locale for this request
+ *
+ * @return The reverse lookup map for the specified locale.
*/
private Map initLookupMap(HttpServletRequest request, Locale userLocale) {
Map lookupMap = new HashMap();
@@ -173,11 +180,13 @@
ModuleConfig moduleConfig =
(ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
- MessageResourcesConfig[] mrc = moduleConfig.findMessageResourcesConfigs();
+ MessageResourcesConfig[] mrc =
+ moduleConfig.findMessageResourcesConfigs();
// Look through all module's MessageResources
for (int i = 0; i < mrc.length; i++) {
- MessageResources resources = this.getResources(request, mrc[i].getKey());
+ MessageResources resources = this.getResources(request,
+ mrc[i].getKey());
// Look for key in MessageResources
Iterator iter = this.keyMethodMap.keySet().iterator();
@@ -222,7 +231,7 @@
// Based on this request's Locale get the lookupMap
Map lookupMap = null;
- synchronized(localeMap) {
+ synchronized (localeMap) {
Locale userLocale = this.getLocale(request);
lookupMap = (Map) this.localeMap.get(userLocale);
@@ -261,6 +270,9 @@
* @param parameter The <code>ActionMapping</code> parameter's name
*
* @return The method's name.
+ *
+ * @throws Exception if an error occurs
+ *
* @since Struts 1.2.0
*/
protected String getMethodName(
Modified: struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java Sat May 14 18:27:02 2005
@@ -213,6 +213,9 @@
* @param parameter The <code>ActionMapping</code> parameter's name
*
* @return The method's name.
+ *
+ * @throws Exception if an error occurs
+ *
* @since Struts 1.2.0
*/
protected String getMethodName(
Modified: struts/core/trunk/src/share/org/apache/struts/actions/SwitchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/SwitchAction.java?rev=170188&r1=170187&r2=170188&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/SwitchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/SwitchAction.java Sat May 14 18:27:02 2005
@@ -62,7 +62,24 @@
protected static Log log = LogFactory.getLog(SwitchAction.class);
- // See superclass for JavaDoc
+ /**
+ * Process the specified HTTP request, and create the corresponding HTTP
+ * response (or forward to another web component that will create it).
+ * Return an <code>ActionForward</code> instance describing where and how
+ * control should be forwarded, or <code>null</code> if the response has
+ * already been completed.
+ *
+ * @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
+ *
+ * @return Return an <code>ActionForward</code> instance describing where
+ * and how control should be forwarded, or <code>null</code> if
+ * the response has already been completed.
+ *
+ * @exception Exception if an exception occurs
+ */
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -79,7 +96,8 @@
}
// Switch to the requested module
- ModuleUtils.getInstance().selectModule(prefix, request, getServlet().getServletContext());
+ ModuleUtils.getInstance().selectModule(prefix, request,
+ getServlet().getServletContext());
if (request.getAttribute(Globals.MODULE_KEY) == null) {
String message = messages.getMessage("switch.prefix", prefix);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org