Author: ivaynberg
Date: Wed Sep 16 06:37:55 2009
New Revision: 815630

URL: http://svn.apache.org/viewvc?rev=815630&view=rev
Log:
WICKET-2469 make diskfileitemfactory customizable
Issue: WICKET-2469

Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java?rev=815630&r1=815629&r2=815630&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
 Wed Sep 16 06:37:55 2009
@@ -31,6 +31,7 @@
 import org.apache.wicket.util.lang.Bytes;
 import org.apache.wicket.util.upload.DiskFileItemFactory;
 import org.apache.wicket.util.upload.FileItem;
+import org.apache.wicket.util.upload.FileItemFactory;
 import org.apache.wicket.util.upload.FileUploadException;
 import org.apache.wicket.util.upload.ServletFileUpload;
 import org.apache.wicket.util.upload.ServletRequestContext;
@@ -65,7 +66,9 @@
 
 
        /**
-        * Constructor
+        * Constructor.
+        * 
+        * This constructor will use {...@link DiskFileItemFactory} to store 
uploads.
         * 
         * @param maxSize
         *            the maximum size allowed for this request
@@ -77,6 +80,25 @@
        public MultipartServletWebRequest(HttpServletRequest request, Bytes 
maxSize)
                throws FileUploadException
        {
+               this(request, maxSize, new DiskFileItemFactory());
+       }
+
+       /**
+        * Constructor
+        * 
+        * @param maxSize
+        *            the maximum size allowed for this request
+        * @param request
+        *            the servlet request
+        * @param factory
+        *            {...@link DiskFileItemFactory} to use when creating file 
items used to represent
+        *            uploaded files
+        * @throws FileUploadException
+        *             Thrown if something goes wrong with upload
+        */
+       public MultipartServletWebRequest(HttpServletRequest request, Bytes 
maxSize,
+               FileItemFactory factory) throws FileUploadException
+       {
                super(request);
 
                if (maxSize == null)
@@ -91,7 +113,6 @@
                        throw new IllegalStateException("ServletRequest does 
not contain multipart content");
                }
 
-               DiskFileItemFactory factory = new DiskFileItemFactory();
 
                // Configure the factory here, if desired.
                ServletFileUpload upload = new ServletFileUpload(factory);


Reply via email to