Home » apache-tomcat-6.0.26-src » org.apache » tomcat » util » http » fileupload » [javadoc | source]
org.apache.tomcat.util.http.fileupload
abstract public class: FileUploadBase [javadoc | source]
java.lang.Object
   org.apache.tomcat.util.http.fileupload.FileUploadBase

Direct Known Subclasses:
    FileUpload, DiskFileUpload

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 #parseRequest(HttpServletRequest) to acquire a list of org.apache.tomcat.util.http.fileupload.FileItem s associated with a given HTML widget.

How the data for individual parts is stored is determined by the factory used to create them; a given part may be in memory, on disk, or somewhere else.

Nested Class Summary:
public static class  FileUploadBase.InvalidContentTypeException  Thrown to indicate that the request is not a multipart request. 
public static class  FileUploadBase.UnknownSizeException  Thrown to indicate that the request size is not specified. 
public static class  FileUploadBase.SizeLimitExceededException  Thrown to indicate that the request size exceeds the configured maximum. 
Field Summary
public static final  String CONTENT_TYPE    HTTP content type header name. 
public static final  String CONTENT_DISPOSITION    HTTP content disposition header name. 
public static final  String FORM_DATA    Content-disposition value for form data. 
public static final  String ATTACHMENT    Content-disposition value for file attachment. 
public static final  String MULTIPART    Part of HTTP content type header. 
public static final  String MULTIPART_FORM_DATA    HTTP content type header for multipart forms. 
public static final  String MULTIPART_MIXED    HTTP content type header for multiple uploads. 
public static final  int MAX_HEADER_SIZE    The maximum length of a single header line that will be parsed (1024 bytes). 
Method from org.apache.tomcat.util.http.fileupload.FileUploadBase Summary:
createItem,   getFieldName,   getFileItemFactory,   getFileName,   getHeader,   getHeaderEncoding,   getSizeMax,   isMultipartContent,   parseHeaders,   parseRequest,   setFileItemFactory,   setHeaderEncoding,   setSizeMax
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tomcat.util.http.fileupload.FileUploadBase Detail:
 protected FileItem createItem(Map headers,
    boolean isFormField) throws FileUploadException 
 protected String getFieldName(Map headers) 
    Retrieves the field name from the Content-disposition header.
 abstract public FileItemFactory getFileItemFactory()
    Returns the factory class used when creating file items.
 protected String getFileName(Map headers) 
    Retrieves the file name from the Content-disposition header.
 protected final String getHeader(Map headers,
    String name) 
    Returns the header with the specified name from the supplied map. The header lookup is case-insensitive.
 public String getHeaderEncoding() 
    Retrieves the character encoding used when reading the headers of an individual part. When not specified, or null, the platform default encoding is used.
 public long getSizeMax() 
    Returns the maximum allowed upload size.
 public static final boolean isMultipartContent(HttpServletRequest req) 
    Utility method that determines whether the request contains multipart content.
 protected Map parseHeaders(String headerPart) 

    Parses the header-part and returns as key/value pairs.

    If there are multiple headers of the same names, the name will map to a comma-separated list containing the values.

 public List parseRequest(HttpServletRequest req) throws FileUploadException 
    Processes an RFC 1867 compliant multipart/form-data stream. If files are stored on disk, the path is given by getRepository().
 abstract public  void setFileItemFactory(FileItemFactory factory)
    Sets the factory class to use when creating file items.
 public  void setHeaderEncoding(String encoding) 
    Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or null, the platform default encoding is used.
 public  void setSizeMax(long sizeMax) 
    Sets the maximum allowed upload size. If negative, there is no maximum.