Package org.apache.commons.fileupload
Class DiskFileUpload
- java.lang.Object
-
- org.apache.commons.fileupload.FileUploadBase
-
- org.apache.commons.fileupload.DiskFileUpload
-
@Deprecated public class DiskFileUpload extends FileUploadBase
Deprecated.1.1 UseServletFileUpload
together withDiskFileItemFactory
instead.High level API for processing file uploads.
This class handles multiple files per single HTML widget, sent using
multipart/mixed
encoding type, as specified by RFC 1867. UseFileUploadBase.parseRequest(HttpServletRequest)
to acquire a list ofFileItem
s associated with a given HTML widget.Individual parts will be stored in temporary disk storage or in memory, depending on their size, and will be available as
FileItem
s.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.fileupload.FileUploadBase
FileUploadBase.FileSizeLimitExceededException, FileUploadBase.FileUploadIOException, FileUploadBase.InvalidContentTypeException, FileUploadBase.IOFileUploadException, FileUploadBase.SizeException, FileUploadBase.SizeLimitExceededException, FileUploadBase.UnknownSizeException
-
-
Field Summary
Fields Modifier and Type Field Description private DefaultFileItemFactory
fileItemFactory
Deprecated.The factory to use to create new form items.-
Fields inherited from class org.apache.commons.fileupload.FileUploadBase
ATTACHMENT, CONTENT_DISPOSITION, CONTENT_LENGTH, CONTENT_TYPE, FORM_DATA, MAX_HEADER_SIZE, MULTIPART, MULTIPART_FORM_DATA, MULTIPART_MIXED
-
-
Constructor Summary
Constructors Constructor Description DiskFileUpload()
Deprecated.1.1 UseFileUpload
instead.DiskFileUpload(DefaultFileItemFactory fileItemFactory)
Deprecated.1.1 UseFileUpload
instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FileItemFactory
getFileItemFactory()
Deprecated.1.1 UseFileUpload
instead.java.lang.String
getRepositoryPath()
Deprecated.1.1 UseDiskFileItemFactory
instead.int
getSizeThreshold()
Deprecated.1.1 UseDiskFileItemFactory
instead.java.util.List<FileItem>
parseRequest(javax.servlet.http.HttpServletRequest req, int sizeThreshold, long sizeMax, java.lang.String path)
Deprecated.1.1 UseServletFileUpload
instead.void
setFileItemFactory(FileItemFactory factory)
Deprecated.1.1 UseFileUpload
instead.void
setRepositoryPath(java.lang.String repositoryPath)
Deprecated.1.1 UseDiskFileItemFactory
instead.void
setSizeThreshold(int sizeThreshold)
Deprecated.1.1 UseDiskFileItemFactory
instead.-
Methods inherited from class org.apache.commons.fileupload.FileUploadBase
createItem, getBoundary, getFieldName, getFieldName, getFileCountMax, getFileName, getFileName, getFileSizeMax, getHeader, getHeaderEncoding, getItemIterator, getParsedHeaders, getProgressListener, getSizeMax, isMultipartContent, isMultipartContent, newFileItemHeaders, parseHeaders, parseParameterMap, parseRequest, parseRequest, setFileCountMax, setFileSizeMax, setHeaderEncoding, setProgressListener, setSizeMax
-
-
-
-
Field Detail
-
fileItemFactory
private DefaultFileItemFactory fileItemFactory
Deprecated.The factory to use to create new form items.
-
-
Constructor Detail
-
DiskFileUpload
@Deprecated public DiskFileUpload()
Deprecated.1.1 UseFileUpload
instead.Constructs an instance of this class which uses the default factory to createFileItem
instances.
-
DiskFileUpload
@Deprecated public DiskFileUpload(DefaultFileItemFactory fileItemFactory)
Deprecated.1.1 UseFileUpload
instead.Constructs an instance of this class which uses the supplied factory to createFileItem
instances.- Parameters:
fileItemFactory
- The file item factory to use.- See Also:
DiskFileUpload()
-
-
Method Detail
-
getFileItemFactory
@Deprecated public FileItemFactory getFileItemFactory()
Deprecated.1.1 UseFileUpload
instead.Returns the factory class used when creating file items.- Specified by:
getFileItemFactory
in classFileUploadBase
- Returns:
- The factory class for new file items.
-
setFileItemFactory
@Deprecated public void setFileItemFactory(FileItemFactory factory)
Deprecated.1.1 UseFileUpload
instead.Sets the factory class to use when creating file items. The factory must be an instance ofDefaultFileItemFactory
or a subclass thereof, or else aClassCastException
will be thrown.- Specified by:
setFileItemFactory
in classFileUploadBase
- Parameters:
factory
- The factory class for new file items.
-
getSizeThreshold
@Deprecated public int getSizeThreshold()
Deprecated.1.1 UseDiskFileItemFactory
instead.Returns the size threshold beyond which files are written directly to disk.- Returns:
- The size threshold, in bytes.
- See Also:
setSizeThreshold(int)
-
setSizeThreshold
@Deprecated public void setSizeThreshold(int sizeThreshold)
Deprecated.1.1 UseDiskFileItemFactory
instead.Sets the size threshold beyond which files are written directly to disk.- Parameters:
sizeThreshold
- The size threshold, in bytes.- See Also:
getSizeThreshold()
-
getRepositoryPath
@Deprecated public java.lang.String getRepositoryPath()
Deprecated.1.1 UseDiskFileItemFactory
instead.Returns the location used to temporarily store files that are larger than the configured size threshold.- Returns:
- The path to the temporary file location.
- See Also:
setRepositoryPath(String)
-
setRepositoryPath
@Deprecated public void setRepositoryPath(java.lang.String repositoryPath)
Deprecated.1.1 UseDiskFileItemFactory
instead.Sets the location used to temporarily store files that are larger than the configured size threshold.- Parameters:
repositoryPath
- The path to the temporary file location.- See Also:
getRepositoryPath()
-
parseRequest
@Deprecated public java.util.List<FileItem> parseRequest(javax.servlet.http.HttpServletRequest req, int sizeThreshold, long sizeMax, java.lang.String path) throws FileUploadException
Deprecated.1.1 UseServletFileUpload
instead.Processes an RFC 1867 compliantmultipart/form-data
stream. If files are stored on disk, the path is given bygetRepository()
.- Parameters:
req
- The servlet request to be parsed. Must be non-null.sizeThreshold
- The max size in bytes to be stored in memory.sizeMax
- The maximum allowed upload size, in bytes.path
- The location where the files should be stored.- Returns:
- A list of
FileItem
instances parsed from the request, in the order that they were transmitted. - Throws:
FileUploadException
- if there are problems reading/parsing the request or storing files.
-
-