Author: husted
Date: Tue Nov 14 05:51:15 2006
New Revision: 474787

URL: http://svn.apache.org/viewvc?view=rev&rev=474787
Log:
WW-1483 JavaDoc and IDEA refactorings only. No functional changes.

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?view=diff&rev=474787&r1=474786&r2=474787
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
(original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
Tue Nov 14 05:51:15 2006
@@ -136,7 +136,7 @@
     /** Whether slashes in action names are allowed or not */
     public static final String STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES = 
"struts.enable.SlashesInActionNames";
 
-    /** Prefix used by [EMAIL PROTECTED] CompositeActionMapper} to identified 
its containing [EMAIL PROTECTED] ActionMapper} class. */
+    /** Prefix used by [EMAIL PROTECTED] CompositeActionMapper} to identify 
its containing [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.mapper.ActionMapper} class. */
     public static final String STRUTS_MAPPER_COMPOSITE = 
"struts.mapper.composite.";
 
     public static final String STRUTS_ACTIONPROXYFACTORY = 
"struts.actionProxyFactory";

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java?view=diff&rev=474787&r1=474786&r2=474787
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
 Tue Nov 14 05:51:15 2006
@@ -37,10 +37,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.inject.Context;
@@ -55,7 +52,7 @@
     private File baseDir = null;
     private String filename;
     private String reloadKey;
-    private Object servletContext;
+    private ServletContext servletContext;
 
     /**
      * Constructs the configuration provider
@@ -71,6 +68,7 @@
      *
      * @param filename The filename to look for
      * @param errorIfMissing If we should throw an exception if the file can't 
be found
+     * @param ctx Our ServletContext
      */
     public StrutsXmlConfigurationProvider(String filename, boolean 
errorIfMissing, ServletContext ctx) {
         super(filename, errorIfMissing);
@@ -116,7 +114,7 @@
      * Look for the configuration file on the classpath and in the file system
      *
      * @param fileName The file name to retrieve
-     * @see 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#getInputStream(java.lang.String)
+     * @see 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#getConfigurationUrls
      */
     @Override
     protected Iterator<URL> getConfigurationUrls(String fileName) throws 
IOException {
@@ -163,10 +161,7 @@
     @Override
     public boolean needsReload() {
         ActionContext ctx = ActionContext.getContext();
-        if (ctx.get(reloadKey) == null) {
-            return super.needsReload();
-        }
-        return false;
+        return ctx.get(reloadKey) == null && super.needsReload();
 
     }
     

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java?view=diff&rev=474787&r1=474786&r2=474787
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java
 Tue Nov 14 05:51:15 2006
@@ -24,36 +24,38 @@
 
 import com.opensymphony.xwork2.config.ConfigurationManager;
 
-
 /**
  * <!-- START SNIPPET: javadoc -->
  *
- * The ActionMapper is responsible for providing a mapping between HTTP 
requests and action invocation requests and
- * vice-versa. When given an HttpServletRequest, the ActionMapper may return 
null if no action invocation request maps,
- * or it may return an [EMAIL PROTECTED] ActionMapping} that describes an 
action invocation that Struts should attempt to try. The
- * ActionMapper is not required to guarantee that the [EMAIL PROTECTED] 
ActionMapping} returned be a real action or otherwise
- * ensure a valid request. This means that most ActionMappers do not need to 
consult the Struts configuration to
- * determine if a request should be mapped.
- *
- * <p/> Just as requests can be mapped from HTTP to an action invocation, the 
opposite is true as well. However, because
- * HTTP requests (when shown in HTTP responses) must be in String form, a 
String is returned rather than an actual
- * request object.
+ * Provide a mapping between HTTP requests and action invocation requests and 
vice-versa.
+ * <p/>
+ * When given an HttpServletRequest, the ActionMapper may return null if no 
action invocation request matches,
+ * or it may return an [EMAIL PROTECTED] ActionMapping} that describes an 
action invocation for the framework to try.
+ * <p/>
+ * The ActionMapper is not required to guarantee that the [EMAIL PROTECTED] 
ActionMapping} returned be a real action or otherwise
+ * ensure a valid request.
+ * Accordingly, most ActionMappers do not need to consult the Struts 
configuration
+ * just to determine if a request should be mapped.
+ * <p/>
+ * Just as requests can be mapped from HTTP to an action invocation, the 
opposite is true as well.
+ * However, because HTTP requests (when shown in HTTP responses) must be in 
String form,
+ * a String is returned rather than an actual request object.
  *
  * <!-- END SNIPPET: javadoc -->
  */
 public interface ActionMapper {
 
     /**
-     * Gets an action mapping for the current request
+     * Expose the ActionMapping for the current request
      *
      * @param request The servlet request
-     * @param config The current configuration manager
+     * @param configManager The current configuration manager
      * @return The appropriate action mapping
      */
     ActionMapping getMapping(HttpServletRequest request, ConfigurationManager 
configManager);
 
     /**
-     * Converts an ActionMapping into a URI string
+     * Convert an ActionMapping into a URI string
      *
      * @param mapping The action mapping
      * @return The URI string that represents this mapping

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java?view=diff&rev=474787&r1=474786&r2=474787
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
 Tue Nov 14 05:51:15 2006
@@ -70,7 +70,6 @@
      * Creates a new request wrapper to handle multi-part data using methods 
adapted from Jason Pell's
      * multipart classes (see class description).
      *
-     * @param maxSize        maximum size post allowed
      * @param saveDir        the directory to save off the file
      * @param servletRequest the request containing the multipart
      * @throws java.io.IOException  is thrown if encoding fails.
@@ -88,8 +87,8 @@
             ServletFileUpload upload = new ServletFileUpload(fac);
             List items = 
upload.parseRequest(createRequestContext(servletRequest));
 
-            for (int i = 0; i < items.size(); i++) {
-                FileItem item = (FileItem) items.get(i);
+            for (Object item1 : items) {
+                FileItem item = (FileItem) item1;
                 if (log.isDebugEnabled()) log.debug("Found item " + 
item.getFieldName());
                 if (item.isFormField()) {
                     log.debug("Item is a normal form field");

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java?view=diff&rev=474787&r1=474786&r2=474787
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
 Tue Nov 14 05:51:15 2006
@@ -22,13 +22,10 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Vector;
 
@@ -36,41 +33,37 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.dispatcher.StrutsRequestWrapper;
-import org.apache.struts2.util.ClassLoaderUtils;
 
 
 /**
- * Parses a multipart request and provides a wrapper around the request. The 
parsing implementation used
+ * Parse a multipart request and provide a wrapper around the request. The 
parsing implementation used
  * depends on the <tt>struts.multipart.parser</tt> setting. It should be set 
to a class which
- * extends [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.multipart.MultiPartRequest}. <p>
+ * extends [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.multipart.MultiPartRequest}. 
  * <p/>
- * Struts ships with three implementations,
- * [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.multipart.PellMultiPartRequest}, and
- * [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.multipart.CosMultiPartRequest} and
- * [EMAIL PROTECTED] 
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest}. The Jakarta 
implementation
- * is the default. The <tt>struts.multipart.parser</tt> property should be set 
to <tt>jakarta</tt> for the
+ * The <tt>struts.multipart.parser</tt> property should be set to 
<tt>jakarta</tt> for the
  * Jakarta implementation, <tt>pell</tt> for the Pell implementation and 
<tt>cos</tt> for the Jason Hunter
- * implementation. <p>
+ * implementation.
  * <p/>
  * The files are uploaded when the object is instantiated. If there are any 
errors they are logged using
  * [EMAIL PROTECTED] #addError(String)}. An action handling a multipart form 
should first check [EMAIL PROTECTED] #hasErrors()}
- * before doing any other processing. <p>
+ * before doing any other processing.
+ * <p/>
+ * An alternate implementation, PellMultiPartRequest, is provided as a plugin.
  *
  */
 public class MultiPartRequestWrapper extends StrutsRequestWrapper {
     protected static final Log log = 
LogFactory.getLog(MultiPartRequestWrapper.class);
 
-    Collection errors;
+    Collection<String> errors;
     MultiPartRequest multi;
 
     /**
-     * Instantiates the appropriate MultiPartRequest parser implementation and 
processes the data.
+     * Process file downloads and log any errors.
      *
-     * @param request the servlet request object
-     * @param saveDir directory to save the file(s) to
-     * @param maxSize maximum file size allowed
+     * @param request Our HttpServletRequest object
+     * @param saveDir Target directory for any files that we save
+     * @param multiPartRequest Our MultiPartRequest object
      */
     public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, 
HttpServletRequest request, String saveDir) {
         super(request);
@@ -78,8 +71,8 @@
         multi = multiPartRequest;
         try {
             multi.parse(request, saveDir);
-            for (Iterator iter = multi.getErrors().iterator(); 
iter.hasNext();) {
-                String error = (String) iter.next();
+            for (Object o : multi.getErrors()) {
+                String error = (String) o;
                 addError(error);
             }
         } catch (IOException e) {
@@ -132,6 +125,7 @@
     /**
      * Get a String array of the file names for uploaded files
      *
+     * @param fieldName Field to check for file names.
      * @return a String[] of file names for uploaded files
      */
     public String[] getFileNames(String fieldName) {
@@ -169,7 +163,7 @@
      * @see javax.servlet.http.HttpServletRequest#getParameterMap()
      */
     public Map getParameterMap() {
-        Map map = new HashMap();
+        Map<String, String[]> map = new HashMap<String, String[]>();
         Enumeration enumeration = getParameterNames();
 
         while (enumeration.hasMoreElements()) {
@@ -204,11 +198,7 @@
      * @return <tt>true</tt> if any errors occured when parsing the HTTP 
multipart request, <tt>false</tt> otherwise.
      */
     public boolean hasErrors() {
-        if ((errors == null) || errors.isEmpty()) {
-            return false;
-        } else {
-            return true;
-        }
+        return !((errors == null) || errors.isEmpty());
     }
 
     /**
@@ -216,7 +206,7 @@
      *
      * @return the error Collection.
      */
-    public Collection getErrors() {
+    public Collection<String> getErrors() {
         return errors;
     }
 
@@ -227,7 +217,7 @@
      */
     protected void addError(String anErrorMessage) {
         if (errors == null) {
-            errors = new ArrayList();
+            errors = new ArrayList<String>();
         }
 
         errors.add(anErrorMessage);


Reply via email to