You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/02/07 15:50:55 UTC

[3/3] git commit: WICKET-5503 Remove local copies of Commons FileUpload files and use Maven dependency

WICKET-5503 Remove local copies of Commons FileUpload files and use Maven dependency


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/99fcd91f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/99fcd91f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/99fcd91f

Branch: refs/heads/master
Commit: 99fcd91fe8c3568750f65e7ed830c62b5d46cdaf
Parents: 7cd01f7
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Feb 7 15:49:51 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Feb 7 15:49:51 2014 +0100

----------------------------------------------------------------------
 .../apache/wicket/markup/html/form/Form.java    |    6 +-
 .../markup/html/form/upload/FileUpload.java     |    6 +-
 .../html/form/upload/FileUploadField.java       |    2 +-
 .../html/form/upload/MultiFileUploadField.java  |    2 +-
 .../protocol/http/IMultipartWebRequest.java     |    2 +-
 .../http/mock/MockHttpServletRequest.java       |    2 +-
 .../servlet/MultipartServletWebRequest.java     |    2 +-
 .../servlet/MultipartServletWebRequestImpl.java |   31 +-
 .../http/servlet/ServletWebRequest.java         |    4 +-
 .../markup/html/form/upload/FileUploadTest.java |   20 +-
 .../wicket/atmosphere/AtmosphereWebRequest.java |    4 +-
 wicket-util/pom.xml                             |   19 +-
 .../apache/wicket/util/file/FileCleaner.java    |    3 +
 .../util/file/FileCleanerTrackerAdapter.java    |   59 +
 .../wicket/util/file/FileCleaningTracker.java   |  331 -----
 .../wicket/util/file/FileDeleteStrategy.java    |  140 --
 .../wicket/util/file/FolderDeleteStrategy.java  |    4 +-
 .../apache/wicket/util/file/IFileCleaner.java   |    2 +
 .../apache/wicket/util/upload/Closeable.java    |   43 -
 .../apache/wicket/util/upload/DiskFileItem.java |  783 -----------
 .../wicket/util/upload/DiskFileItemFactory.java |  205 ---
 .../org/apache/wicket/util/upload/FileItem.java |  215 ---
 .../wicket/util/upload/FileItemFactory.java     |   47 -
 .../wicket/util/upload/FileItemHeaders.java     |   74 -
 .../wicket/util/upload/FileItemHeadersImpl.java |   98 --
 .../util/upload/FileItemHeadersSupport.java     |   46 -
 .../wicket/util/upload/FileItemIterator.java    |   50 -
 .../wicket/util/upload/FileItemStream.java      |   99 --
 .../apache/wicket/util/upload/FileUpload.java   |  114 --
 .../wicket/util/upload/FileUploadBase.java      | 1285 ------------------
 .../wicket/util/upload/FileUploadException.java |  112 --
 .../wicket/util/upload/LimitedInputStream.java  |  173 ---
 .../util/upload/MultipartFormInputStream.java   | 1192 ----------------
 .../wicket/util/upload/ParameterParser.java     |  362 -----
 .../wicket/util/upload/ProgressListener.java    |   38 -
 .../wicket/util/upload/RequestContext.java      |   64 -
 .../wicket/util/upload/ServletFileUpload.java   |  153 ---
 .../util/upload/ServletRequestContext.java      |  113 --
 .../org/apache/wicket/util/upload/package.html  |   30 -
 39 files changed, 129 insertions(+), 5806 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index 7eeb1e1..8386d2a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -26,6 +26,8 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.fileupload.FileUploadBase;
+import org.apache.commons.fileupload.FileUploadException;
 import org.apache.wicket.Component;
 import org.apache.wicket.IGenericComponent;
 import org.apache.wicket.Page;
@@ -60,8 +62,6 @@ import org.apache.wicket.util.string.AppendingStringBuffer;
 import org.apache.wicket.util.string.PrependingStringBuffer;
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.string.interpolator.MapVariableInterpolator;
-import org.apache.wicket.util.upload.FileUploadBase.SizeLimitExceededException;
-import org.apache.wicket.util.upload.FileUploadException;
 import org.apache.wicket.util.value.LongValue;
 import org.apache.wicket.util.visit.ClassVisitFilter;
 import org.apache.wicket.util.visit.IVisit;
@@ -1405,7 +1405,7 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener,
 	protected void onFileUploadException(final FileUploadException e,
 		final Map<String, Object> model)
 	{
-		if (e instanceof SizeLimitExceededException)
+		if (e instanceof FileUploadBase.SizeLimitExceededException)
 		{
 			String msg = getString(UPLOAD_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model));
 			error(msg);

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
index ad54846..ab5e4a0 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
@@ -24,6 +24,7 @@ import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.fileupload.FileItem;
 import org.apache.wicket.util.io.IClusterable;
 import org.apache.wicket.Session;
 import org.apache.wicket.WicketRuntimeException;
@@ -32,7 +33,6 @@ import org.apache.wicket.util.file.Files;
 import org.apache.wicket.util.io.IOUtils;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.string.Strings;
-import org.apache.wicket.util.upload.FileItem;
 
 
 /**
@@ -229,7 +229,7 @@ public class FileUpload implements IClusterable
 	 *            The file
 	 * @throws IOException
 	 */
-	public void writeTo(final File file) throws IOException
+	public void writeTo(final File file) throws Exception
 	{
 		item.write(file);
 	}
@@ -246,7 +246,7 @@ public class FileUpload implements IClusterable
 	 * @return temporary file containing the contents of the uploaded file
 	 * @throws IOException
 	 */
-	public final File writeToTempFile() throws IOException
+	public final File writeToTempFile() throws Exception
 	{
 		String sessionId = Session.exists() ? Session.get().getId() : "";
 		String tempFileName = sessionId + "_" + RequestCycle.get().getStartTime();

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java
index bfd6059..9ebe306 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java
@@ -20,13 +20,13 @@ package org.apache.wicket.markup.html.form.upload;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.fileupload.FileItem;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.protocol.http.IMultipartWebRequest;
 import org.apache.wicket.request.Request;
 import org.apache.wicket.util.convert.ConversionException;
-import org.apache.wicket.util.upload.FileItem;
 
 /**
  * Form component that corresponds to a &lt;input type=&quot;file&quot;&gt;. When a FileInput

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/MultiFileUploadField.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/MultiFileUploadField.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/MultiFileUploadField.java
index 4e803a3..8e907fd 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/MultiFileUploadField.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/MultiFileUploadField.java
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.apache.commons.fileupload.FileItem;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
@@ -42,7 +43,6 @@ import org.apache.wicket.request.resource.JavaScriptResourceReference;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.util.convert.ConversionException;
 import org.apache.wicket.util.string.Strings;
-import org.apache.wicket.util.upload.FileItem;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/protocol/http/IMultipartWebRequest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/IMultipartWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/IMultipartWebRequest.java
index c278d47..529ffc4 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/IMultipartWebRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/IMultipartWebRequest.java
@@ -19,7 +19,7 @@ package org.apache.wicket.protocol.http;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.wicket.util.upload.FileItem;
+import org.apache.commons.fileupload.FileItem;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
index 5cfac7d..53b18f7 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
@@ -55,6 +55,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.Part;
 
+import org.apache.commons.fileupload.FileUploadBase;
 import org.apache.wicket.Application;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.mock.MockRequestParameters;
@@ -67,7 +68,6 @@ import org.apache.wicket.util.io.IOUtils;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.string.StringValue;
 import org.apache.wicket.util.string.Strings;
-import org.apache.wicket.util.upload.FileUploadBase;
 import org.apache.wicket.util.value.ValueMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
index c3ac56c..77d0dec 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java
@@ -21,10 +21,10 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.fileupload.FileItem;
 import org.apache.wicket.protocol.http.IMultipartWebRequest;
 import org.apache.wicket.request.IRequestParameters;
 import org.apache.wicket.request.Url;
-import org.apache.wicket.util.upload.FileItem;
 
 /**
  * Servlet specific WebRequest subclass for multipart content uploads.

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
index 8a036ba..75712bc 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
@@ -26,18 +26,21 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadBase;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.fileupload.servlet.ServletRequestContext;
+import org.apache.commons.io.FileCleaningTracker;
 import org.apache.wicket.Application;
 import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.util.file.FileCleanerTrackerAdapter;
+import org.apache.wicket.util.file.IFileCleaner;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.lang.Bytes;
 import org.apache.wicket.util.string.StringValue;
-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.FileUploadBase;
-import org.apache.wicket.util.upload.FileUploadException;
-import org.apache.wicket.util.upload.ServletFileUpload;
-import org.apache.wicket.util.upload.ServletRequestContext;
 import org.apache.wicket.util.value.ValueMap;
 
 
@@ -87,9 +90,17 @@ public class MultipartServletWebRequestImpl extends MultipartServletWebRequest
 	public MultipartServletWebRequestImpl(HttpServletRequest request, String filterPrefix,
 		Bytes maxSize, String upload) throws FileUploadException
 	{
-		this(request, filterPrefix, maxSize, upload, new DiskFileItemFactory(Application.get()
-			.getResourceSettings()
-			.getFileCleaner()));
+		this(request, filterPrefix, maxSize, upload, new DiskFileItemFactory()
+		{
+			@Override
+			public FileCleaningTracker getFileCleaningTracker()
+			{
+				IFileCleaner fileCleaner = Application.get()
+						.getResourceSettings()
+						.getFileCleaner();
+				return new FileCleanerTrackerAdapter(fileCleaner);
+			}
+		});
 	}
 
 	/**

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
index 0581076..a4ecc20 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
@@ -31,6 +31,8 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
 import org.apache.wicket.protocol.http.RequestUtils;
 import org.apache.wicket.request.IRequestParameters;
 import org.apache.wicket.request.IWritableRequestParameters;
@@ -44,8 +46,6 @@ import org.apache.wicket.util.string.PrependingStringBuffer;
 import org.apache.wicket.util.string.StringValue;
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.time.Time;
-import org.apache.wicket.util.upload.FileItemFactory;
-import org.apache.wicket.util.upload.FileUploadException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-core/src/test/java/org/apache/wicket/markup/html/form/upload/FileUploadTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/upload/FileUploadTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/upload/FileUploadTest.java
index 39325c1..9a25b3b 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/upload/FileUploadTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/upload/FileUploadTest.java
@@ -21,13 +21,15 @@ import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.util.List;
 
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.io.FileCleaningTracker;
 import org.apache.wicket.WicketTestCase;
 import org.apache.wicket.util.file.File;
 import org.apache.wicket.util.file.FileCleaner;
+import org.apache.wicket.util.file.FileCleanerTrackerAdapter;
 import org.apache.wicket.util.file.IFileCleaner;
 import org.apache.wicket.util.tester.FormTester;
-import org.apache.wicket.util.upload.DiskFileItemFactory;
-import org.apache.wicket.util.upload.FileItem;
 import org.junit.Test;
 
 
@@ -49,10 +51,18 @@ public class FileUploadTest extends WicketTestCase
 	@Test
 	public void getInputStream() throws Exception
 	{
-		IFileCleaner fileUploadCleaner = new FileCleaner();
+		final IFileCleaner fileUploadCleaner = new FileCleaner();
 
-		FileItem fileItem = new DiskFileItemFactory(fileUploadCleaner).createItem("dummyFieldName",
-			"text/java", false, "FileUploadTest.java");
+		DiskFileItemFactory itemFactory = new DiskFileItemFactory()
+		{
+			@Override
+			public FileCleaningTracker getFileCleaningTracker()
+			{
+				return new FileCleanerTrackerAdapter(fileUploadCleaner);
+			}
+		};
+		FileItem fileItem = itemFactory.createItem("dummyFieldName",
+				"text/java", false, "FileUploadTest.java");
 		// Initialize the upload
 		fileItem.getOutputStream();
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereWebRequest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereWebRequest.java b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereWebRequest.java
index 18556de..7dd0137 100644
--- a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereWebRequest.java
+++ b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereWebRequest.java
@@ -24,6 +24,8 @@ import java.util.Locale;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
 import org.apache.wicket.protocol.http.RequestUtils;
 import org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest;
 import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
@@ -31,8 +33,6 @@ import org.apache.wicket.request.IRequestParameters;
 import org.apache.wicket.request.Url;
 import org.apache.wicket.util.lang.Bytes;
 import org.apache.wicket.util.time.Time;
-import org.apache.wicket.util.upload.FileItemFactory;
-import org.apache.wicket.util.upload.FileUploadException;
 
 /**
  * Internal request to signal the processing of an event. This request will be mapped by

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-util/pom.xml b/wicket-util/pom.xml
index aa1592a..3c4a4045 100755
--- a/wicket-util/pom.xml
+++ b/wicket-util/pom.xml
@@ -25,13 +25,18 @@
 	</parent>
 	<artifactId>wicket-util</artifactId>
 	<name>Wicket Util</name>
-  <dependencies>
-	<dependency>
-		<groupId>junit</groupId>
-		<artifactId>junit</artifactId>
-		<scope>provided</scope>
-	</dependency>
-  </dependencies>
+	<dependencies>
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.3.1</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
   <build>
   	<pluginManagement>
   		<plugins>

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaner.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaner.java
index 3835192..3b7b5a9 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaner.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaner.java
@@ -18,6 +18,9 @@ package org.apache.wicket.util.file;
 
 import java.io.File;
 
+import org.apache.commons.io.FileCleaningTracker;
+import org.apache.commons.io.FileDeleteStrategy;
+
 /**
  * Default implementation of {@link IFileCleaner} that uses Apache commons-io
  * {@link FileCleaningTracker} to track and clean the temporary created files.

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java
new file mode 100644
index 0000000..d58e23f
--- /dev/null
+++ b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.file;
+
+
+import org.apache.commons.io.FileCleaningTracker;
+import org.apache.commons.io.FileDeleteStrategy;
+import org.apache.wicket.util.lang.Args;
+
+/**
+ * Adapts IFileCleaner to FileCleaningTracker
+ */
+public class FileCleanerTrackerAdapter extends FileCleaningTracker
+{
+	private final IFileCleaner fileCleaner;
+
+	public FileCleanerTrackerAdapter(IFileCleaner fileCleaner)
+	{
+		this.fileCleaner = Args.notNull(fileCleaner, "fileCleaner");
+	}
+
+	@Override
+	public void track(java.io.File file, Object marker)
+	{
+		fileCleaner.track(file, marker);
+	}
+
+	@Override
+	public void track(java.io.File file, Object marker, FileDeleteStrategy deleteStrategy)
+	{
+		fileCleaner.track(file, marker, deleteStrategy);
+	}
+
+	@Override
+	public void track(String path, Object marker)
+	{
+		fileCleaner.track(new File(path), marker);
+	}
+
+	@Override
+	public void track(String path, Object marker, FileDeleteStrategy deleteStrategy)
+	{
+		fileCleaner.track(new File(path), marker, deleteStrategy);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java
deleted file mode 100644
index 04d469f..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.file;
-
-import java.io.File;
-import java.lang.ref.PhantomReference;
-import java.lang.ref.ReferenceQueue;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * Keeps track of files awaiting deletion, and deletes them when an associated marker object is
- * reclaimed by the garbage collector.
- * <p>
- * This utility creates a background thread to handle file deletion. Each file to be deleted is
- * registered with a handler object. When the handler object is garbage collected, the file is
- * deleted.
- * <p>
- * In an environment with multiple class loaders (a servlet container, for example), you should
- * consider stopping the background thread if it is no longer needed. This is done by invoking the
- * method {@link #exitWhenFinished}, typically in
- * {@link javax.servlet.ServletContextListener#contextDestroyed} or similar.
- * 
- * @author Noel Bergman
- * @author Martin Cooper
- * @version $Id$
- */
-public class FileCleaningTracker
-{
-	/**
-	 * Queue of <code>Tracker</code> instances being watched.
-	 */
-	ReferenceQueue<Object> q = new ReferenceQueue<Object>();
-	/**
-	 * Collection of <code>Tracker</code> instances in existence.
-	 */
-	final Collection<Tracker> trackers = Collections.synchronizedSet(new HashSet<Tracker>()); // synchronized
-	/**
-	 * Collection of File paths that failed to delete.
-	 */
-	final List<String> deleteFailures = Collections.synchronizedList(new ArrayList<String>());
-	/**
-	 * Whether to terminate the thread when the tracking is complete.
-	 */
-	volatile boolean exitWhenFinished = false;
-	/**
-	 * The thread that will clean up registered files.
-	 */
-	Thread reaper;
-
-	// -----------------------------------------------------------------------
-	/**
-	 * Track the specified file, using the provided marker, deleting the file when the marker
-	 * instance is garbage collected. The {@link FileDeleteStrategy#NORMAL normal} deletion strategy
-	 * will be used.
-	 * 
-	 * @param file
-	 *            the file to be tracked, not null
-	 * @param marker
-	 *            the marker object used to track the file, not null
-	 * @throws NullPointerException
-	 *             if the file is null
-	 */
-	public void track(final File file, final Object marker)
-	{
-		track(file, marker, (FileDeleteStrategy)null);
-	}
-
-	/**
-	 * Track the specified file, using the provided marker, deleting the file when the marker
-	 * instance is garbage collected. The speified deletion strategy is used.
-	 * 
-	 * @param file
-	 *            the file to be tracked, not null
-	 * @param marker
-	 *            the marker object used to track the file, not null
-	 * @param deleteStrategy
-	 *            the strategy to delete the file, null means normal
-	 * @throws NullPointerException
-	 *             if the file is null
-	 */
-	public void track(final File file, final Object marker, final FileDeleteStrategy deleteStrategy)
-	{
-		if (file == null)
-		{
-			throw new NullPointerException("The file must not be null");
-		}
-		addTracker(file.getPath(), marker, deleteStrategy);
-	}
-
-	/**
-	 * Track the specified file, using the provided marker, deleting the file when the marker
-	 * instance is garbage collected. The {@link FileDeleteStrategy#NORMAL normal} deletion strategy
-	 * will be used.
-	 * 
-	 * @param path
-	 *            the full path to the file to be tracked, not null
-	 * @param marker
-	 *            the marker object used to track the file, not null
-	 * @throws NullPointerException
-	 *             if the path is null
-	 */
-	public void track(final String path, final Object marker)
-	{
-		track(path, marker, null);
-	}
-
-	/**
-	 * Track the specified file, using the provided marker, deleting the file when the marker
-	 * instance is garbage collected. The speified deletion strategy is used.
-	 * 
-	 * @param path
-	 *            the full path to the file to be tracked, not null
-	 * @param marker
-	 *            the marker object used to track the file, not null
-	 * @param deleteStrategy
-	 *            the strategy to delete the file, null means normal
-	 * @throws NullPointerException
-	 *             if the path is null
-	 */
-	public void track(final String path, final Object marker,
-		final FileDeleteStrategy deleteStrategy)
-	{
-		if (path == null)
-		{
-			throw new NullPointerException("The path must not be null");
-		}
-		addTracker(path, marker, deleteStrategy);
-	}
-
-	/**
-	 * Adds a tracker to the list of trackers.
-	 * 
-	 * @param path
-	 *            the full path to the file to be tracked, not null
-	 * @param marker
-	 *            the marker object used to track the file, not null
-	 * @param deleteStrategy
-	 *            the strategy to delete the file, null means normal
-	 */
-	private synchronized void addTracker(final String path, final Object marker,
-		final FileDeleteStrategy deleteStrategy)
-	{
-		// synchronized block protects reaper
-		if (exitWhenFinished)
-		{
-			throw new IllegalStateException(
-				"No new trackers can be added once exitWhenFinished() is called");
-		}
-		if (reaper == null)
-		{
-			reaper = new Reaper();
-			reaper.start();
-		}
-		trackers.add(new Tracker(path, deleteStrategy, marker, q));
-	}
-
-	// -----------------------------------------------------------------------
-	/**
-	 * Retrieve the number of files currently being tracked, and therefore awaiting deletion.
-	 * 
-	 * @return the number of files being tracked
-	 */
-	public int getTrackCount()
-	{
-		return trackers.size();
-	}
-
-	/**
-	 * Return the file paths that failed to delete.
-	 * 
-	 * @return the file paths that failed to delete
-	 * @since Commons IO 2.0
-	 */
-	public List<String> getDeleteFailures()
-	{
-		return deleteFailures;
-	}
-
-	/**
-	 * Call this method to cause the file cleaner thread to terminate when there are no more objects
-	 * being tracked for deletion.
-	 * <p>
-	 * In a simple environment, you don't need this method as the file cleaner thread will simply
-	 * exit when the JVM exits. In a more complex environment, with multiple class loaders (such as
-	 * an application server), you should be aware that the file cleaner thread will continue
-	 * running even if the class loader it was started from terminates. This can consitute a memory
-	 * leak.
-	 * <p>
-	 * For example, suppose that you have developed a web application, which contains the commons-io
-	 * jar file in your WEB-INF/lib directory. In other words, the FileCleaner class is loaded
-	 * through the class loader of your web application. If the web application is terminated, but
-	 * the servlet container is still running, then the file cleaner thread will still exist, posing
-	 * a memory leak.
-	 * <p>
-	 * This method allows the thread to be terminated. Simply call this method in the resource
-	 * cleanup code, such as {@link javax.servlet.ServletContextListener#contextDestroyed}. Once
-	 * called, no new objects can be tracked by the file cleaner.
-	 */
-	public synchronized void exitWhenFinished()
-	{
-		// synchronized block protects reaper
-		exitWhenFinished = true;
-		if (reaper != null)
-		{
-			synchronized (reaper)
-			{
-				reaper.interrupt();
-			}
-		}
-	}
-
-	// -----------------------------------------------------------------------
-	/**
-	 * The reaper thread.
-	 */
-	private final class Reaper extends Thread
-	{
-		/** Construct a new Reaper */
-		Reaper()
-		{
-			super("File Reaper");
-			setPriority(Thread.MAX_PRIORITY);
-			setDaemon(true);
-		}
-
-		/**
-		 * Run the reaper thread that will delete files as their associated marker objects are
-		 * reclaimed by the garbage collector.
-		 */
-		@Override
-		public void run()
-		{
-			// thread exits when exitWhenFinished is true and there are no more tracked objects
-			while ((exitWhenFinished == false) || (trackers.size() > 0))
-			{
-				try
-				{
-					// Wait for a tracker to remove.
-					Tracker tracker = (Tracker)q.remove(); // cannot return null
-					trackers.remove(tracker);
-					if (!tracker.delete())
-					{
-						deleteFailures.add(tracker.getPath());
-					}
-					tracker.clear();
-				}
-				catch (InterruptedException e)
-				{
-					continue;
-				}
-			}
-		}
-	}
-
-	// -----------------------------------------------------------------------
-
-	/**
-	 * Inner class which acts as the reference for a file pending deletion.
-	 */
-	private static final class Tracker extends PhantomReference<Object>
-	{
-		/**
-		 * The full path to the file being tracked.
-		 */
-		private final String path;
-		/**
-		 * The strategy for deleting files.
-		 */
-		private final FileDeleteStrategy deleteStrategy;
-
-		/**
-		 * Constructs an instance of this class from the supplied parameters.
-		 * 
-		 * @param path
-		 *            the full path to the file to be tracked, not null
-		 * @param deleteStrategy
-		 *            the strategy to delete the file, null means normal
-		 * @param marker
-		 *            the marker object used to track the file, not null
-		 * @param queue
-		 *            the queue on to which the tracker will be pushed, not null
-		 */
-		Tracker(final String path, final FileDeleteStrategy deleteStrategy, final Object marker,
-			final ReferenceQueue<? super Object> queue)
-		{
-			super(marker, queue);
-			this.path = path;
-			this.deleteStrategy = (deleteStrategy == null ? FileDeleteStrategy.NORMAL
-				: deleteStrategy);
-		}
-
-		/**
-		 * Return the path.
-		 * 
-		 * @return the path
-		 */
-		public String getPath()
-		{
-			return path;
-		}
-
-		/**
-		 * Deletes the file associated with this tracker instance.
-		 * 
-		 * @return <code>true</code> if the file was deleted successfully; <code>false</code>
-		 *         otherwise.
-		 */
-		public boolean delete()
-		{
-			return deleteStrategy.deleteQuietly(new File(path));
-		}
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java
deleted file mode 100644
index ae769dd..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.file;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Strategy for deleting files.
- * <p>
- * There is more than one way to delete a file. You may want to limit access to certain directories,
- * to only delete directories if they are empty, or maybe to force deletion.
- * <p>
- * This class captures the strategy to use and is designed for user subclassing.
- * 
- * @author Stephen Colebourne
- * @version $Id$
- * @since Commons IO 1.3
- */
-public class FileDeleteStrategy
-{
-	/**
-	 * The singleton instance for normal file deletion, which does not permit the deletion of
-	 * directories that are not empty.
-	 */
-	public static final FileDeleteStrategy NORMAL = new FileDeleteStrategy("Normal");
-
-	/** The name of the strategy. */
-	private final String name;
-
-	// -----------------------------------------------------------------------
-	/**
-	 * Restricted constructor.
-	 * 
-	 * @param name
-	 *            the name by which the strategy is known
-	 */
-	protected FileDeleteStrategy(final String name)
-	{
-		this.name = name;
-	}
-
-	// -----------------------------------------------------------------------
-	/**
-	 * Deletes the file object, which may be a file or a directory. All <code>IOException</code>s
-	 * are caught and false returned instead. If the file does not exist or is null, true is
-	 * returned.
-	 * <p>
-	 * Subclass writers should override {@link #doDelete(File)}, not this method.
-	 * 
-	 * @param fileToDelete
-	 *            the file to delete, null returns true
-	 * @return true if the file was deleted, or there was no such file
-	 */
-	public boolean deleteQuietly(final File fileToDelete)
-	{
-		if ((fileToDelete == null) || (fileToDelete.exists() == false))
-		{
-			return true;
-		}
-		try
-		{
-			return doDelete(fileToDelete);
-		}
-		catch (IOException ex)
-		{
-			return false;
-		}
-	}
-
-	/**
-	 * Deletes the file object, which may be a file or a directory. If the file does not exist, the
-	 * method just returns.
-	 * <p>
-	 * Subclass writers should override {@link #doDelete(File)}, not this method.
-	 * 
-	 * @param fileToDelete
-	 *            the file to delete, not null
-	 * @throws NullPointerException
-	 *             if the file is null
-	 * @throws IOException
-	 *             if an error occurs during file deletion
-	 */
-	public void delete(final File fileToDelete) throws IOException
-	{
-		if (fileToDelete.exists() && (doDelete(fileToDelete) == false))
-		{
-			throw new IOException("Deletion failed: " + fileToDelete);
-		}
-	}
-
-	/**
-	 * Actually deletes the file object, which may be a file or a directory.
-	 * <p>
-	 * This method is designed for subclasses to override. The implementation may return either
-	 * false or an <code>IOException</code> when deletion fails. The {@link #delete(File)} and
-	 * {@link #deleteQuietly(File)} methods will handle either response appropriately. A check has
-	 * been made to ensure that the file will exist.
-	 * <p>
-	 * This implementation uses {@link File#delete()}.
-	 * 
-	 * @param fileToDelete
-	 *            the file to delete, exists, not null
-	 * @return true if the file was deleteds
-	 * @throws NullPointerException
-	 *             if the file is null
-	 * @throws IOException
-	 *             if an error occurs during file deletion
-	 */
-	protected boolean doDelete(final File fileToDelete) throws IOException
-	{
-		return fileToDelete.delete();
-	}
-
-	// -----------------------------------------------------------------------
-	/**
-	 * Gets a string describing the delete strategy.
-	 * 
-	 * @return a string describing the delete strategy
-	 */
-	@Override
-	public String toString()
-	{
-		return "FileDeleteStrategy[" + name + "]";
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/FolderDeleteStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FolderDeleteStrategy.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FolderDeleteStrategy.java
index 88f067f..2e9395f 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/file/FolderDeleteStrategy.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/file/FolderDeleteStrategy.java
@@ -19,6 +19,8 @@ package org.apache.wicket.util.file;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.commons.io.FileDeleteStrategy;
+
 /**
  * A {@link FileDeleteStrategy} that can delete folders.
  */
@@ -26,8 +28,6 @@ public class FolderDeleteStrategy extends FileDeleteStrategy
 {
 	/**
 	 * Construct.
-	 * 
-	 * @param name
 	 */
 	protected FolderDeleteStrategy()
 	{

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/file/IFileCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/IFileCleaner.java b/wicket-util/src/main/java/org/apache/wicket/util/file/IFileCleaner.java
index 4da6633..3f9fe16 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/file/IFileCleaner.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/file/IFileCleaner.java
@@ -18,6 +18,8 @@ package org.apache.wicket.util.file;
 
 import java.io.File;
 
+import org.apache.commons.io.FileDeleteStrategy;
+
 /**
  * Keeps track of files awaiting deletion, and deletes them when an associated marker object is
  * reclaimed by the garbage collector.

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/Closeable.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/Closeable.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/Closeable.java
deleted file mode 100644
index 1c7b459..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/Closeable.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-import java.io.IOException;
-
-
-/**
- * Interface of an object, which may be closed.
- */
-public interface Closeable
-{
-	/**
-	 * Closes the object.
-	 * 
-	 * @throws IOException
-	 *             An I/O error occurred.
-	 */
-	void close() throws IOException;
-
-	/**
-	 * Returns, whether the object is already closed.
-	 * 
-	 * @return True, if the object is closed, otherwise false.
-	 * @throws IOException
-	 *             An I/O error occurred.
-	 */
-	boolean isClosed() throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java
deleted file mode 100644
index f4ec711..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java
+++ /dev/null
@@ -1,783 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-
-import org.apache.wicket.util.file.Files;
-import org.apache.wicket.util.file.IFileCleaner;
-import org.apache.wicket.util.io.DeferredFileOutputStream;
-import org.apache.wicket.util.io.IOUtils;
-import org.apache.wicket.util.io.Streams;
-import org.apache.wicket.util.lang.Checks;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <p>
- * The default implementation of the {@link org.apache.wicket.util.upload.FileItem FileItem}
- * interface.
- * 
- * <p>
- * After retrieving an instance of this class from a
- * {@link org.apache.wicket.util.upload.FileUpload#FileUpload(FileItemFactory)} instance (see
- * {@link org.apache.wicket.util.upload.FileUploadBase#parseRequest(RequestContext)}
- * ), you may either request all contents of file at once using {@link #get()} or request an
- * {@link java.io.InputStream InputStream} with {@link #getInputStream()} and process the file
- * without attempting to load it into memory, which may come handy with large files.
- * 
- * <p>
- * When using the <code>DiskFileItemFactory</code>, then you should consider the following:
- * Temporary files are automatically deleted as soon as they are no longer needed. (More precisely,
- * when the corresponding instance of {@link java.io.File} is garbage collected.) This is done by
- * the so-called reaper thread, which is started automatically when the class
- * {@link org.apache.wicket.util.file.FileCleaner} is loaded. It might make sense to terminate that
- * thread, for example, if your web application ends. See the section on "Resource cleanup" in the
- * users guide of commons-fileupload.
- * </p>
- * 
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- * @author Sean C. Sullivan
- */
-public class DiskFileItem implements FileItem, FileItemHeadersSupport
-{
-	private static final Logger log = LoggerFactory.getLogger(DiskFileItem.class);
-
-	/**
-	 * The UID to use when serializing this instance.
-	 */
-	private static final long serialVersionUID = 2237570099615271025L;
-
-	/**
-	 * Default content charset to be used when no explicit charset parameter is provided by the
-	 * sender. Media subtypes of the "text" type are defined to have a default charset value of
-	 * "ISO-8859-1" when received via HTTP.
-	 */
-	public static final String DEFAULT_CHARSET = "ISO-8859-1";
-
-	// ----------------------------------------------------------- Data members
-
-	/**
-	 * UID used in unique file name generation.
-	 */
-	private static final String UID = UUID.randomUUID()
-		.toString()
-		.replace(':', '_')
-		.replace('-', '_');
-
-	/**
-	 * Random counter used in unique identifier generation.
-	 */
-	private static final Random counter = new Random();
-
-	/**
-	 * The name of the form field as provided by the browser.
-	 */
-	private String fieldName;
-
-	/**
-	 * The content type passed by the browser, or <code>null</code> if not defined.
-	 */
-	private final String contentType;
-
-	/**
-	 * Whether or not this item is a simple form field.
-	 */
-	private boolean isFormField;
-
-	/**
-	 * The original filename in the user's filesystem.
-	 */
-	private final String fileName;
-
-	/**
-	 * The size of the item, in bytes. This is used to cache the size when a file item is moved from
-	 * its original location.
-	 */
-	private long size = -1;
-
-	/**
-	 * The threshold above which uploads will be stored on disk.
-	 */
-	private final int sizeThreshold;
-
-	/**
-	 * The directory in which uploaded files will be stored, if stored on disk.
-	 */
-	private final File repository;
-
-	/**
-	 * Cached contents of the file.
-	 */
-	private byte[] cachedContent;
-
-	/**
-	 * Output stream for this item.
-	 */
-	private transient DeferredFileOutputStream dfos;
-
-	/**
-	 * The temporary file to use.
-	 */
-	private transient File tempFile;
-
-	/**
-	 * File to allow for serialization of the content of this item.
-	 */
-	private File dfosFile;
-
-	/**
-	 * The file items headers.
-	 */
-	private FileItemHeaders headers;
-
-	/**
-	 * This is transient because it is needed only for the upload request lifetime to add this file
-	 * item in the tracker. After that the cleaner is not needed anymore.
-	 */
-	private transient final IFileCleaner fileUploadCleaner;
-
-	/**
-	 * Constructs a new <code>DiskFileItem</code> instance.
-	 * 
-	 * @param fieldName
-	 *            The name of the form field.
-	 * @param contentType
-	 *            The content type passed by the browser or <code>null</code> if not specified.
-	 * @param isFormField
-	 *            Whether or not this item is a plain form field, as opposed to a file upload.
-	 * @param fileName
-	 *            The original filename in the user's filesystem, or <code>null</code> if not
-	 *            specified.
-	 * @param sizeThreshold
-	 *            The threshold, in bytes, below which items will be retained in memory and above
-	 *            which they will be stored as a file.
-	 * @param repository
-	 *            The data repository, which is the directory in which files will be created, should
-	 *            the item size exceed the threshold.
-	 * @param fileUploadCleaner
-	 */
-	public DiskFileItem(final String fieldName, final String contentType,
-		final boolean isFormField, final String fileName, final int sizeThreshold,
-		final File repository, final IFileCleaner fileUploadCleaner)
-	{
-		this.fieldName = fieldName;
-		this.contentType = contentType;
-		this.isFormField = isFormField;
-		this.fileName = fileName;
-		this.sizeThreshold = sizeThreshold;
-		this.repository = repository;
-		this.fileUploadCleaner = fileUploadCleaner;
-	}
-
-	/**
-	 * Returns an {@link java.io.InputStream InputStream} that can be used to retrieve the contents
-	 * of the file.
-	 * 
-	 * @return An {@link java.io.InputStream InputStream} that can be used to retrieve the contents
-	 *         of the file.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	@Override
-	public InputStream getInputStream() throws IOException
-	{
-		if (!isInMemory())
-		{
-			return new FileInputStream(dfos.getFile());
-		}
-
-		if (cachedContent == null)
-		{
-			cachedContent = dfos.getData();
-		}
-		return new ByteArrayInputStream(cachedContent);
-	}
-
-	/**
-	 * Returns the content type passed by the agent or <code>null</code> if not defined.
-	 * 
-	 * @return The content type passed by the agent or <code>null</code> if not defined.
-	 */
-	@Override
-	public String getContentType()
-	{
-		return contentType;
-	}
-
-	/**
-	 * Returns the content charset passed by the agent or <code>null</code> if not defined.
-	 * 
-	 * @return The content charset passed by the agent or <code>null</code> if not defined.
-	 */
-	public String getCharSet()
-	{
-		ParameterParser parser = new ParameterParser();
-		parser.setLowerCaseNames(true);
-		// Parameter parser can handle null input
-		Map<?, ?> params = parser.parse(getContentType(), ';');
-		return (String)params.get("charset");
-	}
-
-	/**
-	 * Returns the original filename in the client's filesystem.
-	 * 
-	 * @return The original filename in the client's filesystem.
-	 */
-	@Override
-	public String getName()
-	{
-		return fileName;
-	}
-
-	/**
-	 * Provides a hint as to whether or not the file contents will be read from memory.
-	 * 
-	 * @return <code>true</code> if the file contents will be read from memory; <code>false</code>
-	 *         otherwise.
-	 */
-	@Override
-	public boolean isInMemory()
-	{
-		if (cachedContent != null)
-		{
-			return true;
-		}
-		return dfos.isInMemory();
-	}
-
-	/**
-	 * Returns the size of the file.
-	 * 
-	 * @return The size of the file, in bytes.
-	 */
-	@Override
-	public long getSize()
-	{
-		if (size >= 0)
-		{
-			return size;
-		}
-		else if (cachedContent != null)
-		{
-			return cachedContent.length;
-		}
-		else if (dfos.isInMemory())
-		{
-			return dfos.getData().length;
-		}
-		else
-		{
-			return dfos.getFile().length();
-		}
-	}
-
-	/**
-	 * Returns the contents of the file as an array of bytes. If the contents of the file were not
-	 * yet cached in memory, they will be loaded from the disk storage and cached.
-	 * 
-	 * @return The contents of the file as an array of bytes.
-	 */
-	@Override
-	public byte[] get()
-	{
-		if (isInMemory())
-		{
-			if (cachedContent == null)
-			{
-				cachedContent = dfos.getData();
-			}
-			return cachedContent;
-		}
-
-		File file = dfos.getFile();
-
-		try
-		{
-			return Files.readBytes(file);
-		}
-		catch (IOException e)
-		{
-			log.debug("failed to read content of file: " + file.getAbsolutePath(), e);
-			return null;
-		}
-	}
-
-
-	/**
-	 * Returns the contents of the file as a String, using the specified encoding. This method uses
-	 * {@link #get()} to retrieve the contents of the file.
-	 * 
-	 * @param charset
-	 *            The charset to use.
-	 * 
-	 * @return The contents of the file, as a string.
-	 * 
-	 * @throws UnsupportedEncodingException
-	 *             if the requested character encoding is not available.
-	 */
-	@Override
-	public String getString(final String charset) throws UnsupportedEncodingException
-	{
-		return new String(get(), charset);
-	}
-
-	/**
-	 * Returns the contents of the file as a String, using the default character encoding. This
-	 * method uses {@link #get()} to retrieve the contents of the file.
-	 * 
-	 * @return The contents of the file, as a string.
-	 * 
-	 * @todo Consider making this method throw UnsupportedEncodingException.
-	 */
-	@Override
-	public String getString()
-	{
-		byte[] rawdata = get();
-		String charset = getCharSet();
-		if (charset == null)
-		{
-			charset = DEFAULT_CHARSET;
-		}
-		try
-		{
-			return new String(rawdata, charset);
-		}
-		catch (UnsupportedEncodingException e)
-		{
-			return new String(rawdata);
-		}
-	}
-
-
-	/**
-	 * A convenience method to write an uploaded item to disk. The client code is not concerned with
-	 * whether or not the item is stored in memory, or on disk in a temporary location. They just
-	 * want to write the uploaded item to a file.
-	 * <p>
-	 * This implementation first attempts to rename the uploaded item to the specified destination
-	 * file, if the item was originally written to disk. Otherwise, the data will be copied to the
-	 * specified file.
-	 * <p>
-	 * This method is only guaranteed to work <em>once</em>, the first time it is invoked for a
-	 * particular item. This is because, in the event that the method renames a temporary file, that
-	 * file will no longer be available to copy or rename again at a later time.
-	 * 
-	 * @param file
-	 *            The <code>File</code> into which the uploaded item should be stored.
-	 * 
-	 * @throws Exception
-	 *             if an error occurs.
-	 */
-	@Override
-	public void write(final File file) throws IOException
-	{
-		if (isInMemory())
-		{
-			FileOutputStream fout = new FileOutputStream(file);
-
-			try
-			{
-				fout.write(get());
-			}
-			finally
-			{
-				fout.close();
-			}
-		}
-		else
-		{
-			File outputFile = getStoreLocation();
-			Checks.notNull(outputFile,
-				"for a non-memory upload the file location must not be empty");
-
-			// Save the length of the file
-			size = outputFile.length();
-			/*
-			 * The uploaded file is being stored on disk in a temporary location so move it to the
-			 * desired file.
-			 */
-			if (!outputFile.renameTo(file))
-			{
-				BufferedInputStream in = null;
-				BufferedOutputStream out = null;
-				try
-				{
-					in = new BufferedInputStream(new FileInputStream(outputFile));
-					out = new BufferedOutputStream(new FileOutputStream(file));
-					Streams.copy(in, out);
-				}
-				finally
-				{
-					IOUtils.closeQuietly(in);
-					IOUtils.closeQuietly(out);
-				}
-			}
-		}
-	}
-
-	/**
-	 * Deletes the underlying storage for a file item, including deleting any associated temporary
-	 * disk file. Although this storage will be deleted automatically when the <code>FileItem</code>
-	 * instance is garbage collected, this method can be used to ensure that this is done at an
-	 * earlier time, thus preserving system resources.
-	 */
-	@Override
-	public void delete()
-	{
-		cachedContent = null;
-		File outputFile = getStoreLocation();
-		if ((outputFile != null) && outputFile.exists())
-		{
-			if (Files.remove(outputFile) == false)
-			{
-				log.error("failed to delete file: " + outputFile.getAbsolutePath());
-			}
-		}
-	}
-
-
-	/**
-	 * Returns the name of the field in the multipart form corresponding to this file item.
-	 * 
-	 * @return The name of the form field.
-	 * 
-	 * @see #setFieldName(java.lang.String)
-	 * 
-	 */
-	@Override
-	public String getFieldName()
-	{
-		return fieldName;
-	}
-
-	/**
-	 * Sets the field name used to reference this file item.
-	 * 
-	 * @param fieldName
-	 *            The name of the form field.
-	 * 
-	 * @see #getFieldName()
-	 * 
-	 */
-	@Override
-	public void setFieldName(final String fieldName)
-	{
-		this.fieldName = fieldName;
-	}
-
-	/**
-	 * Determines whether or not a <code>FileItem</code> instance represents a simple form field.
-	 * 
-	 * @return <code>true</code> if the instance represents a simple form field; <code>false</code>
-	 *         if it represents an uploaded file.
-	 * 
-	 * @see #setFormField(boolean)
-	 * 
-	 */
-	@Override
-	public boolean isFormField()
-	{
-		return isFormField;
-	}
-
-
-	/**
-	 * Specifies whether or not a <code>FileItem</code> instance represents a simple form field.
-	 * 
-	 * @param state
-	 *            <code>true</code> if the instance represents a simple form field;
-	 *            <code>false</code> if it represents an uploaded file.
-	 * 
-	 * @see #isFormField()
-	 * 
-	 */
-	@Override
-	public void setFormField(final boolean state)
-	{
-		isFormField = state;
-	}
-
-
-	/**
-	 * Returns an {@link java.io.OutputStream OutputStream} that can be used for storing the
-	 * contents of the file.
-	 * 
-	 * @return An {@link java.io.OutputStream OutputStream} that can be used for storing the
-	 *         contensts of the file.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	@Override
-	public OutputStream getOutputStream() throws IOException
-	{
-		if (dfos == null)
-		{
-			dfos = new DeferredFileOutputStream(sizeThreshold,
-				new DeferredFileOutputStream.FileFactory()
-				{
-					@Override
-					public File createFile()
-					{
-						return getTempFile();
-					}
-				});
-		}
-		return dfos;
-	}
-
-
-	// --------------------------------------------------------- Public methods
-
-
-	/**
-	 * Returns the {@link java.io.File} object for the <code>FileItem</code>'s data's temporary
-	 * location on the disk. Note that for <code>FileItem</code>s that have their data stored in
-	 * memory, this method will return <code>null</code>. When handling large files, you can use
-	 * {@link java.io.File#renameTo(java.io.File)} to move the file to new location without copying
-	 * the data, if the source and destination locations reside within the same logical volume.
-	 * 
-	 * @return The data file, or <code>null</code> if the data is stored in memory.
-	 */
-	public File getStoreLocation()
-	{
-		return dfos == null ? null : dfos.getFile();
-	}
-
-
-	// ------------------------------------------------------ Protected methods
-
-
-	/**
-	 * Removes the file contents from the temporary storage.
-	 */
-	@Override
-	protected void finalize() throws Throwable
-	{
-		super.finalize(); // currently empty but there for safer refactoring
-
-		File outputFile = dfos.getFile();
-
-		if ((outputFile != null) && outputFile.exists())
-		{
-			if (Files.remove(outputFile) == false)
-			{
-				log.error("failed to delete file: " + outputFile.getAbsolutePath());
-			}
-		}
-	}
-
-
-	/**
-	 * Creates and returns a {@link java.io.File File} representing a uniquely named temporary file
-	 * in the configured repository path. The lifetime of the file is tied to the lifetime of the
-	 * <code>FileItem</code> instance; the file will be deleted when the instance is garbage
-	 * collected.
-	 * 
-	 * @return The {@link java.io.File File} to be used for temporary storage.
-	 */
-	protected File getTempFile()
-	{
-		if (tempFile == null)
-		{
-			File tempDir = repository;
-			if (tempDir == null)
-			{
-				String systemTmp = null;
-				try
-				{
-					systemTmp = System.getProperty("java.io.tmpdir");
-				}
-				catch (SecurityException e)
-				{
-					throw new RuntimeException(
-						"Reading property java.io.tmpdir is not allowed"
-							+ " for the current security settings. The repository location needs to be"
-							+ " set manually, or upgrade permissions to allow reading the tmpdir property.");
-				}
-				tempDir = new File(systemTmp);
-			}
-
-			try
-			{
-				do
-				{
-					String tempFileName = "upload_" + UID + "_" + getUniqueId() + ".tmp";
-					tempFile = new File(tempDir, tempFileName);
-				}
-				while (!tempFile.createNewFile());
-			}
-			catch (IOException e)
-			{
-				throw new RuntimeException("Could not create the temp file for upload: " +
-					tempFile.getAbsolutePath(), e);
-			}
-
-			if (fileUploadCleaner != null)
-			{
-				fileUploadCleaner.track(tempFile, this);
-			}
-		}
-		return tempFile;
-	}
-
-	// -------------------------------------------------------- Private methods
-
-
-	/**
-	 * Returns an identifier that is unique within the class loader used to load this class, but
-	 * does not have random-like appearance.
-	 * 
-	 * @return A String with the non-random looking instance identifier.
-	 */
-	private static String getUniqueId()
-	{
-		final int limit = 100000000;
-		int current;
-		synchronized (DiskFileItem.class)
-		{
-			current = counter.nextInt();
-		}
-		String id = Integer.toString(current);
-
-		// If you manage to get more than 100 million of ids, you'll
-		// start getting ids longer than 8 characters.
-		if (current < limit)
-		{
-			id = ("00000000" + id).substring(id.length());
-		}
-		return id;
-	}
-
-
-	/**
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString()
-	{
-		return "name=" + getName() + ", StoreLocation=" + String.valueOf(getStoreLocation()) +
-			", size=" + getSize() + "bytes, " + "isFormField=" + isFormField() + ", FieldName=" +
-			getFieldName();
-	}
-
-
-	// -------------------------------------------------- Serialization methods
-
-
-	/**
-	 * Writes the state of this object during serialization.
-	 * 
-	 * @param out
-	 *            The stream to which the state should be written.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	private void writeObject(final ObjectOutputStream out) throws IOException
-	{
-		// Read the data
-		if (dfos.isInMemory())
-		{
-			cachedContent = get();
-		}
-		else
-		{
-			cachedContent = null;
-			dfosFile = dfos.getFile();
-		}
-
-		// write out values
-		out.defaultWriteObject();
-	}
-
-	/**
-	 * Reads the state of this object during deserialization.
-	 * 
-	 * @param in
-	 *            The stream from which the state should be read.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 * @throws ClassNotFoundException
-	 *             if class cannot be found.
-	 */
-	private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException
-	{
-		// read values
-		in.defaultReadObject();
-
-		OutputStream output = getOutputStream();
-		if (cachedContent != null)
-		{
-			output.write(cachedContent);
-		}
-		else
-		{
-			FileInputStream input = new FileInputStream(dfosFile);
-			Streams.copy(input, output);
-			Files.remove(dfosFile);
-			dfosFile = null;
-		}
-		output.close();
-
-		cachedContent = null;
-	}
-
-	/**
-	 * Returns the file item headers.
-	 * 
-	 * @return The file items headers.
-	 */
-	@Override
-	public FileItemHeaders getHeaders()
-	{
-		return headers;
-	}
-
-	/**
-	 * Sets the file item headers.
-	 * 
-	 * @param pHeaders
-	 *            The file items headers.
-	 */
-	@Override
-	public void setHeaders(final FileItemHeaders pHeaders)
-	{
-		headers = pHeaders;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItemFactory.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItemFactory.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItemFactory.java
deleted file mode 100644
index 0123e1f..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItemFactory.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-import java.io.File;
-
-import org.apache.wicket.util.file.FileCleaningTracker;
-import org.apache.wicket.util.file.IFileCleaner;
-
-
-/**
- * <p>
- * The default {@link org.apache.wicket.util.upload.FileItemFactory} implementation. This
- * implementation creates {@link org.apache.wicket.util.upload.FileItem} instances which keep their
- * content either in memory, for smaller items, or in a temporary file on disk, for larger items.
- * The size threshold, above which content will be stored on disk, is configurable, as is the
- * directory in which temporary files will be created.
- * </p>
- * 
- * <p>
- * If not otherwise configured, the default configuration values are as follows:
- * <ul>
- * <li>Size threshold is 10KB.</li>
- * <li>Repository is the system default temp directory, as returned by
- * <code>System.getProperty("java.io.tmpdir")</code>.</li>
- * </ul>
- * </p>
- * 
- * <p>
- * When using the <code>DiskFileItemFactory</code>, then you should consider the following:
- * Temporary files are automatically deleted as soon as they are no longer needed. (More precisely,
- * when the corresponding instance of {@link java.io.File} is garbage collected.) Cleaning up those
- * files is done by an instance of {@link FileCleaningTracker}, and an associated thread. In a
- * complex environment, for example in a web application, you should consider terminating this
- * thread, for example, when your web application ends. See the section on "Resource cleanup" in the
- * users guide of commons-fileupload.
- * </p>
- * 
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- */
-public class DiskFileItemFactory implements FileItemFactory
-{
-
-	// ----------------------------------------------------- Manifest constants
-
-
-	/**
-	 * The default threshold above which uploads will be stored on disk.
-	 */
-	public static final int DEFAULT_SIZE_THRESHOLD = 10240;
-
-
-	// ----------------------------------------------------- Instance Variables
-
-
-	/**
-	 * The directory in which uploaded files will be stored, if stored on disk.
-	 */
-	private File repository;
-
-
-	/**
-	 * The threshold above which uploads will be stored on disk.
-	 */
-	private int sizeThreshold = DEFAULT_SIZE_THRESHOLD;
-
-	private final IFileCleaner fileUploadCleaner;
-
-	// ----------------------------------------------------------- Constructors
-
-
-	/**
-	 * Constructs an unconfigured instance of this class. The resulting factory may be configured by
-	 * calling the appropriate setter methods.
-	 * 
-	 * @param fileUploadCleaner
-	 */
-	public DiskFileItemFactory(final IFileCleaner fileUploadCleaner)
-	{
-		this(DEFAULT_SIZE_THRESHOLD, null, fileUploadCleaner);
-	}
-
-
-	/**
-	 * Constructs a preconfigured instance of this class.
-	 * 
-	 * @param sizeThreshold
-	 *            The threshold, in bytes, below which items will be retained in memory and above
-	 *            which they will be stored as a file.
-	 * @param repository
-	 *            The data repository, which is the directory in which files will be created, should
-	 *            the item size exceed the threshold.
-	 * @param fileUploadCleaner
-	 */
-	public DiskFileItemFactory(final int sizeThreshold, final File repository,
-		final IFileCleaner fileUploadCleaner)
-	{
-		this.sizeThreshold = sizeThreshold;
-		this.repository = repository;
-		this.fileUploadCleaner = fileUploadCleaner;
-	}
-
-	// ------------------------------------------------------------- Properties
-
-
-	/**
-	 * Returns the directory used to temporarily store files that are larger than the configured
-	 * size threshold.
-	 * 
-	 * @return The directory in which temporary files will be located.
-	 * 
-	 * @see #setRepository(java.io.File)
-	 * 
-	 */
-	public File getRepository()
-	{
-		return repository;
-	}
-
-
-	/**
-	 * Sets the directory used to temporarily store files that are larger than the configured size
-	 * threshold.
-	 * 
-	 * @param repository
-	 *            The directory in which temporary files will be located.
-	 * 
-	 * @see #getRepository()
-	 * 
-	 */
-	public void setRepository(final File repository)
-	{
-		this.repository = repository;
-	}
-
-
-	/**
-	 * Returns the size threshold beyond which files are written directly to disk. The default value
-	 * is 10240 bytes.
-	 * 
-	 * @return The size threshold, in bytes.
-	 * 
-	 * @see #setSizeThreshold(int)
-	 */
-	public int getSizeThreshold()
-	{
-		return sizeThreshold;
-	}
-
-
-	/**
-	 * Sets the size threshold beyond which files are written directly to disk.
-	 * 
-	 * @param sizeThreshold
-	 *            The size threshold, in bytes.
-	 * 
-	 * @see #getSizeThreshold()
-	 * 
-	 */
-	public void setSizeThreshold(final int sizeThreshold)
-	{
-		this.sizeThreshold = sizeThreshold;
-	}
-
-
-	// --------------------------------------------------------- Public Methods
-
-	/**
-	 * Create a new {@link org.apache.wicket.util.upload.DiskFileItem} instance from the supplied
-	 * parameters and the local factory configuration.
-	 * 
-	 * @param fieldName
-	 *            The name of the form field.
-	 * @param contentType
-	 *            The content type of the form field.
-	 * @param isFormField
-	 *            <code>true</code> if this is a plain form field; <code>false</code> otherwise.
-	 * @param fileName
-	 *            The name of the uploaded file, if any, as supplied by the browser or other client.
-	 * 
-	 * @return The newly created file item.
-	 */
-	@Override
-	public FileItem createItem(final String fieldName, final String contentType,
-		final boolean isFormField, final String fileName)
-	{
-		return new DiskFileItem(fieldName, contentType, isFormField, fileName, sizeThreshold,
-			repository, fileUploadCleaner);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItem.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItem.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItem.java
deleted file mode 100644
index bfdf357..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItem.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-import org.apache.wicket.util.io.IClusterable;
-
-/**
- * <p>
- * This class represents a file or form item that was received within a
- * <code>multipart/form-data</code> POST request.
- * 
- * <p>
- * After retrieving an instance of this class from a
- * {@link org.apache.wicket.util.upload.FileUpload FileUpload} instance (see
- * {@link org.apache.wicket.util.upload.FileUpload #parseRequest(javax.servlet.http.HttpServletRequest)}
- * ), you may either request all contents of the file at once using {@link #get()} or request an
- * {@link java.io.InputStream InputStream} with {@link #getInputStream()} and process the file
- * without attempting to load it into memory, which may come handy with large files.
- * 
- * <p>
- * While this interface does not extend <code>javax.activation.DataSource</code> per se (to avoid a
- * seldom used dependency), several of the defined methods are specifically defined with the same
- * signatures as methods in that interface. This allows an implementation of this interface to also
- * implement <code>javax.activation.DataSource</code> with minimal additional work.
- * 
- * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- */
-public interface FileItem extends IClusterable
-{
-
-
-	// ------------------------------- Methods from javax.activation.DataSource
-
-
-	/**
-	 * Returns an {@link java.io.InputStream InputStream} that can be used to retrieve the contents
-	 * of the file.
-	 * 
-	 * @return An {@link java.io.InputStream InputStream} that can be used to retrieve the contents
-	 *         of the file.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	InputStream getInputStream() throws IOException;
-
-
-	/**
-	 * Returns the content type passed by the browser or <code>null</code> if not defined.
-	 * 
-	 * @return The content type passed by the browser or <code>null</code> if not defined.
-	 */
-	String getContentType();
-
-
-	/**
-	 * Returns the original filename in the client's filesystem, as provided by the browser (or
-	 * other client software). In most cases, this will be the base file name, without path
-	 * information. However, some clients, such as the Opera browser, do include path information.
-	 * 
-	 * @return The original filename in the client's filesystem.
-	 */
-	String getName();
-
-
-	// ------------------------------------------------------- FileItem methods
-
-
-	/**
-	 * Provides a hint as to whether or not the file contents will be read from memory.
-	 * 
-	 * @return <code>true</code> if the file contents will be read from memory; <code>false</code>
-	 *         otherwise.
-	 */
-	boolean isInMemory();
-
-
-	/**
-	 * Returns the size of the file item.
-	 * 
-	 * @return The size of the file item, in bytes.
-	 */
-	long getSize();
-
-
-	/**
-	 * Returns the contents of the file item as an array of bytes.
-	 * 
-	 * @return The contents of the file item as an array of bytes.
-	 */
-	byte[] get();
-
-
-	/**
-	 * Returns the contents of the file item as a String, using the specified encoding. This method
-	 * uses {@link #get()} to retrieve the contents of the item.
-	 * 
-	 * @param encoding
-	 *            The character encoding to use.
-	 * 
-	 * @return The contents of the item, as a string.
-	 * 
-	 * @throws UnsupportedEncodingException
-	 *             if the requested character encoding is not available.
-	 */
-	String getString(String encoding) throws UnsupportedEncodingException;
-
-
-	/**
-	 * Returns the contents of the file item as a String, using the default character encoding. This
-	 * method uses {@link #get()} to retrieve the contents of the item.
-	 * 
-	 * @return The contents of the item, as a string.
-	 */
-	String getString();
-
-
-	/**
-	 * A convenience method to write an uploaded item to disk. The client code is not concerned with
-	 * whether or not the item is stored in memory, or on disk in a temporary location. They just
-	 * want to write the uploaded item to a file.
-	 * <p>
-	 * This method is not guaranteed to succeed if called more than once for the same item. This
-	 * allows a particular implementation to use, for example, file renaming, where possible, rather
-	 * than copying all of the underlying data, thus gaining a significant performance benefit.
-	 * 
-	 * @param file
-	 *            The <code>File</code> into which the uploaded item should be stored.
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	void write(File file) throws IOException;
-
-
-	/**
-	 * Deletes the underlying storage for a file item, including deleting any associated temporary
-	 * disk file. Although this storage will be deleted automatically when the <code>FileItem</code>
-	 * instance is garbage collected, this method can be used to ensure that this is done at an
-	 * earlier time, thus preserving system resources.
-	 */
-	void delete();
-
-
-	/**
-	 * Returns the name of the field in the multipart form corresponding to this file item.
-	 * 
-	 * @return The name of the form field.
-	 */
-	String getFieldName();
-
-
-	/**
-	 * Sets the field name used to reference this file item.
-	 * 
-	 * @param name
-	 *            The name of the form field.
-	 */
-	void setFieldName(String name);
-
-
-	/**
-	 * Determines whether or not a <code>FileItem</code> instance represents a simple form field.
-	 * 
-	 * @return <code>true</code> if the instance represents a simple form field; <code>false</code>
-	 *         if it represents an uploaded file.
-	 */
-	boolean isFormField();
-
-
-	/**
-	 * Specifies whether or not a <code>FileItem</code> instance represents a simple form field.
-	 * 
-	 * @param state
-	 *            <code>true</code> if the instance represents a simple form field;
-	 *            <code>false</code> if it represents an uploaded file.
-	 */
-	void setFormField(boolean state);
-
-
-	/**
-	 * Returns an {@link java.io.OutputStream OutputStream} that can be used for storing the
-	 * contents of the file.
-	 * 
-	 * @return An {@link java.io.OutputStream OutputStream} that can be used for storing the
-	 *         contents of the file.
-	 * 
-	 * @throws IOException
-	 *             if an error occurs.
-	 */
-	OutputStream getOutputStream() throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemFactory.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemFactory.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemFactory.java
deleted file mode 100644
index 6c01c8f..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-
-/**
- * <p>
- * A factory interface for creating {@link FileItem} instances. Factories can provide their own
- * custom configuration, over and above that provided by the default file upload implementation.
- * </p>
- * 
- * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
- */
-public interface FileItemFactory
-{
-
-	/**
-	 * Create a new {@link FileItem} instance from the supplied parameters and any local factory
-	 * configuration.
-	 * 
-	 * @param fieldName
-	 *            The name of the form field.
-	 * @param contentType
-	 *            The content type of the form field.
-	 * @param isFormField
-	 *            <code>true</code> if this is a plain form field; <code>false</code> otherwise.
-	 * @param fileName
-	 *            The name of the uploaded file, if any, as supplied by the browser or other client.
-	 * 
-	 * @return The newly created file item.
-	 */
-	FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/99fcd91f/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeaders.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeaders.java b/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeaders.java
deleted file mode 100644
index 8e1f128..0000000
--- a/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeaders.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.upload;
-
-import java.util.Iterator;
-
-/**
- * <p>
- * This class provides support for accessing the headers for a file or form item that was received
- * within a <code>multipart/form-data</code> POST request.
- * </p>
- * 
- * @author Michael C. Macaluso
- */
-public interface FileItemHeaders
-{
-	/**
-	 * Returns the value of the specified part header as a <code>String</code>. If the part did not
-	 * include a header of the specified name, this method return <code>null</code>. If there are
-	 * multiple headers with the same name, this method returns the first header in the item. The
-	 * header name is case insensitive.
-	 * 
-	 * @param name
-	 *            a <code>String</code> specifying the header name
-	 * @return a <code>String</code> containing the value of the requested header, or
-	 *         <code>null</code> if the item does not have a header of that name
-	 */
-	String getHeader(String name);
-
-	/**
-	 * <p>
-	 * Returns all the values of the specified item header as an <code>Enumeration</code> of
-	 * <code>String</code> objects.
-	 * </p>
-	 * <p>
-	 * If the item did not include any headers of the specified name, this method returns an empty
-	 * <code>Enumeration</code>. The header name is case insensitive.
-	 * </p>
-	 * 
-	 * @param name
-	 *            a <code>String</code> specifying the header name
-	 * @return an <code>Enumeration</code> containing the values of the requested header. If the
-	 *         item does not have any headers of that name, return an empty <code>Enumeration</code>
-	 */
-	Iterator<String> getHeaders(String name);
-
-	/**
-	 * <p>
-	 * Returns an <code>Enumeration</code> of all the header names.
-	 * </p>
-	 * <p>
-	 * If the item did not include any headers of the specified name, this method returns an empty
-	 * <code>Enumeration</code>. The header name is case insensitive.
-	 * </p>
-	 * 
-	 * @return an <code>Enumeration</code> containing the values of the requested header. If the
-	 *         item does not have any headers of that name return an empty <code>Enumeration</code>
-	 */
-	Iterator<String> getHeaderNames();
-}