| java.lang.Object net.jforum.util.legacy.commons.fileupload.FileUploadBase
All known Subclasses: net.jforum.util.legacy.commons.fileupload.DiskFileUpload, net.jforum.util.legacy.commons.fileupload.FileUpload,
FileUploadBase | abstract public class FileUploadBase (Code) | | 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
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.
author: Rafal Krzewski author: Daniel Rall author: Jason van Zyl author: John McNally author: Martin Cooper author: Sean C. Sullivan version: $Id: FileUploadBase.java,v 1.3 2005/07/26 03:05:02 rafaelsteil Exp $ |
Method Summary | |
protected FileItem | createItem(Map headers, boolean isFormField) Creates a new
FileItem instance.
Parameters: headers - A Map containing the HTTP requestheaders. Parameters: isFormField - Whether or not this item is a form field, asopposed to a file. | protected byte[] | getBoundary(String contentType) Retrieves the boundary from the Content-type header.
Parameters: contentType - The value of the content type header from which toextract the boundary value. | protected String | getFieldName(Map headers) Retrieves the field name from the Content-disposition
header.
Parameters: headers - A Map containing the HTTP request headers. | 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.
Parameters: headers - A Map containing the HTTP request headers. | final protected String | getHeader(Map headers, String name) Returns the header with the specified name from the supplied map. | public String | getHeaderEncoding() Retrieves the character encoding used when reading the headers of an
individual part. | public long | getSizeMax() Returns the maximum allowed upload size. | final public static 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.
Parameters: ctx - The request context to be evaluated. | final public static boolean | isMultipartContent(HttpServletRequest req) Utility method that determines whether the request contains multipart
content.
Parameters: req - The servlet request to be evaluated. | 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.
Parameters: headerPart - The header-part of the currentencapsulation . | public List | parseRequest(HttpServletRequest req) Processes an RFC 1867
compliant multipart/form-data stream.
Parameters: req - The servlet request to be parsed. | public List | parseRequest(RequestContext ctx) Processes an RFC 1867
compliant multipart/form-data stream.
Parameters: ctx - The context for the request to be parsed. | 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. | public void | setSizeMax(long sizeMax) Sets the maximum allowed upload size. |
ATTACHMENT | final public static String ATTACHMENT(Code) | | Content-disposition value for file attachment.
|
CONTENT_DISPOSITION | final public static String CONTENT_DISPOSITION(Code) | | HTTP content disposition header name.
|
CONTENT_TYPE | final public static String CONTENT_TYPE(Code) | | HTTP content type header name.
|
FORM_DATA | final public static String FORM_DATA(Code) | | Content-disposition value for form data.
|
MAX_HEADER_SIZE | final public static int MAX_HEADER_SIZE(Code) | | The maximum length of a single header line that will be parsed
(1024 bytes).
|
MULTIPART | final public static String MULTIPART(Code) | | Part of HTTP content type header.
|
MULTIPART_FORM_DATA | final public static String MULTIPART_FORM_DATA(Code) | | HTTP content type header for multipart forms.
|
MULTIPART_MIXED | final public static String MULTIPART_MIXED(Code) | | HTTP content type header for multiple uploads.
|
createItem | protected FileItem createItem(Map headers, boolean isFormField)(Code) | | Creates a new
FileItem instance.
Parameters: headers - A Map containing the HTTP requestheaders. Parameters: isFormField - Whether or not this item is a form field, asopposed to a file. A newly created FileItem instance. exception: FileUploadException - if an error occurs. |
getBoundary | protected byte[] getBoundary(String contentType)(Code) | | Retrieves the boundary from the Content-type header.
Parameters: contentType - The value of the content type header from which toextract the boundary value. The boundary, as a byte array. |
getFieldName | protected String getFieldName(Map headers)(Code) | | Retrieves the field name from the Content-disposition
header.
Parameters: headers - A Map containing the HTTP request headers. The field name for the current encapsulation . |
getFileItemFactory | abstract public FileItemFactory getFileItemFactory()(Code) | | Returns the factory class used when creating file items.
The factory class for new file items. |
getFileName | protected String getFileName(Map headers)(Code) | | Retrieves the file name from the Content-disposition
header.
Parameters: headers - A Map containing the HTTP request headers. The file name for the current encapsulation . |
getHeader | final protected String getHeader(Map headers, String name)(Code) | | Returns the header with the specified name from the supplied map. The
header lookup is case-insensitive.
Parameters: headers - A Map containing the HTTP request headers. Parameters: name - The name of the header to return. The value of specified header, or a comma-separated list ifthere were multiple headers of that name. |
getHeaderEncoding | public String getHeaderEncoding()(Code) | | Retrieves the character encoding used when reading the headers of an
individual part. When not specified, or null , the platform
default encoding is used.
The encoding used to read part headers. |
isMultipartContent | final public static boolean isMultipartContent(RequestContext ctx)(Code) | | 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.
Parameters: ctx - The request context to be evaluated. Must be non-null. true if the request is multipart;false otherwise. |
isMultipartContent | final public static boolean isMultipartContent(HttpServletRequest req)(Code) | | Utility method that determines whether the request contains multipart
content.
Parameters: req - The servlet request to be evaluated. Must be non-null. true if the request is multipart;false otherwise. |
parseHeaders | protected Map parseHeaders(String headerPart)(Code) | | 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.
Parameters: headerPart - The header-part of the currentencapsulation . A Map containing the parsed HTTP request headers. |
parseRequest | public List parseRequest(HttpServletRequest req) throws FileUploadException(Code) | | Processes an RFC 1867
compliant multipart/form-data stream.
Parameters: req - The servlet request to be parsed. A list of FileItem instances parsed from therequest, in the order that they were transmitted. exception: FileUploadException - if there are problems reading/parsingthe request or storing files. |
parseRequest | public List parseRequest(RequestContext ctx) throws FileUploadException(Code) | | Processes an RFC 1867
compliant multipart/form-data stream.
Parameters: ctx - The context for the request to be parsed. A list of FileItem instances parsed from therequest, in the order that they were transmitted. exception: FileUploadException - if there are problems reading/parsingthe request or storing files. |
setFileItemFactory | abstract public void setFileItemFactory(FileItemFactory factory)(Code) | | Sets the factory class to use when creating file items.
Parameters: factory - The factory class for new file items. |
setHeaderEncoding | public void setHeaderEncoding(String encoding)(Code) | | 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.
Parameters: encoding - The encoding used to read part headers. |
setSizeMax | public void setSizeMax(long sizeMax)(Code) | | Sets the maximum allowed upload size. If negative, there is no maximum.
Parameters: sizeMax - The maximum allowed size, in bytes, or -1 for no maximum. See Also: FileUploadBase.getSizeMax() |
|
|