Package org.apache.commons.fileupload
Class DiskFileUpload
java.lang.Object
org.apache.commons.fileupload.FileUploadBase
org.apache.commons.fileupload.DiskFileUpload
Deprecated.
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. Use FileUploadBase.parseRequest(HttpServletRequest) to acquire a list of FileItems 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 FileItems.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.fileupload.FileUploadBase
FileUploadBase.FileSizeLimitExceededException, FileUploadBase.FileUploadIOException, FileUploadBase.InvalidContentTypeException, FileUploadBase.IOFileUploadException, FileUploadBase.SizeLimitExceededException, FileUploadBase.UnknownSizeException -
Field Summary
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
ConstructorsConstructorDescriptionDeprecated.1.1 UseFileUploadinstead.DiskFileUpload(DefaultFileItemFactory fileItemFactory) Deprecated.1.1 UseFileUploadinstead. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.1.1 UseFileUploadinstead.Deprecated.1.1 UseDiskFileItemFactoryinstead.intDeprecated.1.1 UseDiskFileItemFactoryinstead.parseRequest(HttpServletRequest req, int sizeThreshold, long sizeMax, String path) Deprecated.1.1 UseServletFileUploadinstead.voidsetFileItemFactory(FileItemFactory factory) Deprecated.1.1 UseFileUploadinstead.voidsetRepositoryPath(String repositoryPath) Deprecated.1.1 UseDiskFileItemFactoryinstead.voidsetSizeThreshold(int sizeThreshold) Deprecated.1.1 UseDiskFileItemFactoryinstead.Methods inherited from class org.apache.commons.fileupload.FileUploadBase
getFileCountMax, getFileSizeMax, getHeaderEncoding, getItemIterator, getProgressListener, getSizeMax, isMultipartContent, isMultipartContent, parseParameterMap, parseRequest, parseRequest, setFileCountMax, setFileSizeMax, setHeaderEncoding, setProgressListener, setSizeMax
-
Constructor Details
-
DiskFileUpload
Deprecated.1.1 UseFileUploadinstead.Constructs an instance of this class which uses the default factory to createFileIteminstances.- See Also:
-
DiskFileUpload
Deprecated.1.1 UseFileUploadinstead.Constructs an instance of this class which uses the supplied factory to createFileIteminstances.- Parameters:
fileItemFactory- The file item factory to use.- See Also:
-
-
Method Details
-
getFileItemFactory
Deprecated.1.1 UseFileUploadinstead.Returns the factory class used when creating file items.- Specified by:
getFileItemFactoryin classFileUploadBase- Returns:
- The factory class for new file items.
-
setFileItemFactory
Deprecated.1.1 UseFileUploadinstead.Sets the factory class to use when creating file items. The factory must be an instance ofDefaultFileItemFactoryor a subclass thereof, or else aClassCastExceptionwill be thrown.- Specified by:
setFileItemFactoryin classFileUploadBase- Parameters:
factory- The factory class for new file items.
-
getSizeThreshold
Deprecated.1.1 UseDiskFileItemFactoryinstead.Returns the size threshold beyond which files are written directly to disk.- Returns:
- The size threshold, in bytes.
- See Also:
-
setSizeThreshold
Deprecated.1.1 UseDiskFileItemFactoryinstead.Sets the size threshold beyond which files are written directly to disk.- Parameters:
sizeThreshold- The size threshold, in bytes.- See Also:
-
getRepositoryPath
Deprecated.1.1 UseDiskFileItemFactoryinstead.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
Deprecated.1.1 UseDiskFileItemFactoryinstead.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:
-
parseRequest
@Deprecated public List<FileItem> parseRequest(HttpServletRequest req, int sizeThreshold, long sizeMax, String path) throws FileUploadException Deprecated.1.1 UseServletFileUploadinstead.Processes an RFC 1867 compliantmultipart/form-datastream. 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
FileIteminstances parsed from the request, in the order that they were transmitted. - Throws:
FileUploadException- if there are problems reading/parsing the request or storing files.
-
ServletFileUploadtogether withDiskFileItemFactoryinstead.