org.apache.commons.fileupload
Class DiskFileUpload

java.lang.Object
  extended by org.apache.commons.fileupload.FileUploadBase
      extended by org.apache.commons.fileupload.DiskFileUpload

Deprecated. Use ServletFileUpload together with DiskFileItemFactory instead.

public class DiskFileUpload
extends FileUploadBase

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.

Version:
$Id: DiskFileUpload.java 479484 2006-11-27 01:06:53Z jochen $
Author:
Rafal Krzewski, Daniel Rall, Jason van Zyl, John McNally, Martin Cooper, Sean C. Sullivan

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 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
DiskFileUpload()
          Deprecated. Use FileUpload instead.
DiskFileUpload(DefaultFileItemFactory fileItemFactory)
          Deprecated. Use FileUpload instead.
 
Method Summary
 FileItemFactory getFileItemFactory()
          Deprecated. Use FileUpload instead.
 String getRepositoryPath()
          Deprecated. Use DiskFileItemFactory instead.
 int getSizeThreshold()
          Deprecated. Use DiskFileItemFactory instead.
 List parseRequest(javax.servlet.http.HttpServletRequest req, int sizeThreshold, long sizeMax, String path)
          Deprecated. Use ServletFileUpload instead.
 void setFileItemFactory(FileItemFactory factory)
          Deprecated. Use FileUpload instead.
 void setRepositoryPath(String repositoryPath)
          Deprecated. Use DiskFileItemFactory instead.
 void setSizeThreshold(int sizeThreshold)
          Deprecated. Use DiskFileItemFactory instead.
 
Methods inherited from class org.apache.commons.fileupload.FileUploadBase
createItem, getBoundary, getFieldName, getFieldName, getFileName, getFileName, getFileSizeMax, getHeader, getHeaderEncoding, getItemIterator, getParsedHeaders, getProgressListener, getSizeMax, isMultipartContent, isMultipartContent, newFileItemHeaders, parseHeaders, parseRequest, parseRequest, setFileSizeMax, setHeaderEncoding, setProgressListener, setSizeMax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskFileUpload

public DiskFileUpload()
Deprecated. Use FileUpload instead.

Constructs an instance of this class which uses the default factory to create FileItem instances.

See Also:
DiskFileUpload(DefaultFileItemFactory fileItemFactory)

DiskFileUpload

public DiskFileUpload(DefaultFileItemFactory fileItemFactory)
Deprecated. Use FileUpload instead.

Constructs an instance of this class which uses the supplied factory to create FileItem instances.

Parameters:
fileItemFactory - The file item factory to use.
See Also:
DiskFileUpload()
Method Detail

getFileItemFactory

public FileItemFactory getFileItemFactory()
Deprecated. Use FileUpload instead.

Returns the factory class used when creating file items.

Specified by:
getFileItemFactory in class FileUploadBase
Returns:
The factory class for new file items.

setFileItemFactory

public void setFileItemFactory(FileItemFactory factory)
Deprecated. Use FileUpload instead.

Sets the factory class to use when creating file items. The factory must be an instance of DefaultFileItemFactory or a subclass thereof, or else a ClassCastException will be thrown.

Specified by:
setFileItemFactory in class FileUploadBase
Parameters:
factory - The factory class for new file items.

getSizeThreshold

public int getSizeThreshold()
Deprecated. Use DiskFileItemFactory instead.

Returns the size threshold beyond which files are written directly to disk.

Returns:
The size threshold, in bytes.
See Also:
setSizeThreshold(int)

setSizeThreshold

public void setSizeThreshold(int sizeThreshold)
Deprecated. Use DiskFileItemFactory instead.

Sets the size threshold beyond which files are written directly to disk.

Parameters:
sizeThreshold - The size threshold, in bytes.
See Also:
getSizeThreshold()

getRepositoryPath

public String getRepositoryPath()
Deprecated. Use DiskFileItemFactory 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

public void setRepositoryPath(String repositoryPath)
Deprecated. Use DiskFileItemFactory 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

public List parseRequest(javax.servlet.http.HttpServletRequest req,
                         int sizeThreshold,
                         long sizeMax,
                         String path)
                  throws FileUploadException
Deprecated. Use ServletFileUpload instead.

Processes an RFC 1867 compliant multipart/form-data stream. If files are stored on disk, the path is given by getRepository().

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.


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.