struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/upload DiskMultipartRequestHandler.java
Date Sat, 02 Aug 2003 22:22:13 GMT
dgraham     2003/08/02 15:22:13

  Modified:    src/share/org/apache/struts/upload
                        DiskMultipartRequestHandler.java
  Log:
  Use ModuleUtils.getModuleConfig() instead of looking in the request
  directly.
  
  Revision  Changes    Path
  1.24      +19 -11    jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java
  
  Index: DiskMultipartRequestHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DiskMultipartRequestHandler.java	2 Jul 2003 03:03:55 -0000	1.23
  +++ DiskMultipartRequestHandler.java	2 Aug 2003 22:22:13 -0000	1.24
  @@ -63,18 +63,19 @@
   
   import java.io.File;
   import java.io.IOException;
  -import java.util.Hashtable;
   import java.util.Enumeration;
  +import java.util.Hashtable;
  +
   import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.struts.action.ActionServlet;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionServlet;
   import org.apache.struts.config.ModuleConfig;
  -import org.apache.struts.Globals;
  +import org.apache.struts.util.ModuleUtils;
   
   /**
    * This is a MultipartRequestHandler that writes file data directly to
  @@ -127,12 +128,17 @@
        * the request wrapper will be populated as well.
        */
       public void handleRequest(HttpServletRequest request) throws ServletException {
  -        ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
  -        retrieveTempDir(moduleConfig);
  +        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
  +        this.retrieveTempDir(moduleConfig);
  +        
           try {
  -            MultipartIterator iterator = new MultipartIterator(request, moduleConfig.getControllerConfig().getBufferSize(),
  -                                                               getMaxSize(moduleConfig.getControllerConfig().getMaxFileSize()),
  -                                                               tempDir);
  +            MultipartIterator iterator =
  +                new MultipartIterator(
  +                    request,
  +                    moduleConfig.getControllerConfig().getBufferSize(),
  +                    getMaxSize(moduleConfig.getControllerConfig().getMaxFileSize()),
  +                    tempDir);
  +                    
               MultipartElement element;
   
               textElements = new Hashtable();
  @@ -146,10 +152,12 @@
                       createDiskFile(element);
                   }
               }
  +            
               //take care of maximum length being exceeded
               if (iterator.isMaxLengthExceeded()) {
                   request.setAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED,
Boolean.TRUE);
               }
  +            
           } catch(IOException ioe) {
               throw new ServletException(ioe);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message