Class SilverpeasDiskFileItemFactory
- java.lang.Object
-
- org.apache.commons.fileupload.disk.DiskFileItemFactory
-
- org.apache.commons.fileupload.disk.SilverpeasDiskFileItemFactory
-
- All Implemented Interfaces:
org.apache.commons.fileupload.FileItemFactory
public class SilverpeasDiskFileItemFactory extends org.apache.commons.fileupload.disk.DiskFileItemFactory
This factory is to replace the one provided by the FileUpload Apache Commons as a workaround of a no yet fixed bug in the Apache library. The DiskFileItemFactory class in FileUpload Apache Commons has a bug when used in conjonction with a tracker of non-long used temporary files (see http://blog.novoj.net/2012/09/19/commons-file-upload-contains-a-severe-memory-leak/ for a description of the bug and https://issues.apache.org/jira/browse/FILEUPLOAD-189 for a look at the bug fix status). This implementation aims to replace the original DiskFileItemFactory class by fixing the bug (in the hope it will be fix in a next release of the FileUpload Apache Commons library). Beside this bug, some default parameters are also set for the particular use of Silverpeas:- the path of the temporary directory in use in Silverpeas,
- the thresold size above which the uploaded files are temporarly stored in disk.
- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description SilverpeasDiskFileItemFactory()
Constructs a new SilverpeasDiskFileItemFactory by setting by default the following parameters: the size threshold is set at 2Mo: about this size, the file are temporarly stored in disk; the temporary directory is the default one used in Silverpeas (@see org.silverpeas.core.util.file.FileRepositoryManager#getTemporaryPath()); a temporary file cleaner is set: all stored file in disks are deleted once no more unused (@see org.apache.commons.fileupload.disk.DiskFileItemFactory).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.fileupload.FileItem
createItem(String fieldName, String contentType, boolean isFormField, String fileName)
-
-
-
Constructor Detail
-
SilverpeasDiskFileItemFactory
public SilverpeasDiskFileItemFactory()
Constructs a new SilverpeasDiskFileItemFactory by setting by default the following parameters:- the size threshold is set at 2Mo: about this size, the file are temporarly stored in disk;
- the temporary directory is the default one used in Silverpeas (@see org.silverpeas.core.util.file.FileRepositoryManager#getTemporaryPath());
- a temporary file cleaner is set: all stored file in disks are deleted once no more unused (@see org.apache.commons.fileupload.disk.DiskFileItemFactory).
-
-
Method Detail
-
createItem
public org.apache.commons.fileupload.FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName)
- Specified by:
createItem
in interfaceorg.apache.commons.fileupload.FileItemFactory
- Overrides:
createItem
in classorg.apache.commons.fileupload.disk.DiskFileItemFactory
-
-