Save This Page
Home » commons-fileupload-1.2-src » org.apache.commons » fileupload » [javadoc | source]
org.apache.commons.fileupload
abstract public class: FileUploadBase [javadoc | source]
java.lang.Object
   org.apache.commons.fileupload.FileUploadBase

Direct Known Subclasses:
    PortletFileUpload, FileUpload, DiskFileUpload, ServletFileUpload

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.commons.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.FileUploadIOException  This exception is thrown for hiding an inner {@link FileUploadException} in an {@link IOException}. 
public static class  FileUploadBase.InvalidContentTypeException  Thrown to indicate that the request is not a multipart request. 
public static class  FileUploadBase.IOFileUploadException  Thrown to indicate an IOException. 
abstract protected static class  FileUploadBase.SizeException  This exception is thrown, if a requests permitted size is exceeded. 
public static class  FileUploadBase.UnknownSizeException  Thrown to indicate that the request size is not specified. In other words, it is thrown, if the content-length header is missing or contains the value -1. 
public static class  FileUploadBase.SizeLimitExceededException  Thrown to indicate that the request size exceeds the configured maximum. 
public static class  FileUploadBase.FileSizeLimitExceededException  Thrown to indicate that A files 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.commons.fileupload.FileUploadBase Summary:
    createItem,   getBoundary,   getFieldName,   getFileItemFactory,   getFileName,   getFileSizeMax,   getHeader,   getHeaderEncoding,   getItemIterator,   getProgressListener,   getSizeMax,   isMultipartContent,   isMultipartContent,   parseHeaders,   parseRequest,   parseRequest,   setFileItemFactory,   setFileSizeMax,   setHeaderEncoding,   setProgressListener,   setSizeMax
    Methods from java.lang.Object:
    equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
    Method from org.apache.commons.fileupload.FileUploadBase Detail:
     protected FileItem createItem(Map headers,
        boolean isFormField) throws FileUploadException 
    Deprecated! This - method is no longer used in favour of internally created instances of FileItem .

     protected byte[] getBoundary(String contentType) 
      Retrieves the boundary from the Content-type header.
     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.
     public long getFileSizeMax() 
      Returns the maximum allowed size of a single uploaded file, as opposed to #getSizeMax() .
     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 request encoding is used. If that is also not specified, or null, the platform default encoding is used.
     public FileItemIterator getItemIterator(RequestContext ctx) throws IOException, FileUploadException 
      Processes an RFC 1867 compliant multipart/form-data stream.
     public ProgressListener getProgressListener() 
      Returns the progress listener.
     public long getSizeMax() 
      Returns the maximum allowed size of a complete request, as opposed to #getFileSizeMax() .
     public static final boolean isMultipartContent(RequestContext ctx) 

      Utility method that determines whether the request contains multipart content.

      NOTE:This method will be moved to the ServletFileUpload class after the FileUpload 1.1 release. Unfortunately, since this method is static, it is not possible to provide its replacement until this method is removed.

     public static boolean isMultipartContent(HttpServletRequest req) 
    Deprecated! Use - the method on ServletFileUpload instead.

      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 
    Deprecated! Use - the method in ServletFileUpload instead.

      Processes an RFC 1867 compliant multipart/form-data stream.
     public List parseRequest(RequestContext ctx) throws FileUploadException 
      Processes an RFC 1867 compliant multipart/form-data stream.
     abstract public  void setFileItemFactory(FileItemFactory factory)
      Sets the factory class to use when creating file items.
     public  void setFileSizeMax(long fileSizeMax) 
      Sets the maximum allowed size of a single uploaded file, as opposed to #getSizeMax() .
     public  void setHeaderEncoding(String encoding) 
      Specifies the character encoding to be used when reading the headers of individual part. When not specified, or null, the request encoding is used. If that is also not specified, or null, the platform default encoding is used.
     public  void setProgressListener(ProgressListener pListener) 
      Sets the progress listener.
     public  void setSizeMax(long sizeMax)