| java.lang.Object de.ug2t.extTools.httpFileUpLoad.AFileUploadBase
All known Subclasses: de.ug2t.extTools.httpFileUpLoad.FileUpload, de.ug2t.extTools.httpFileUpLoad.DiskFileUpload,
AFileUploadBase | abstract public class AFileUploadBase (Code) | |
High level API for processing file uploads.
This class handles multiple files per single MARKUP widget, sent using
multipart/mixed encoding type, as specified by RFC 1867. Use
AFileUploadBase.parseRequest(HttpServletRequest) to acquire a list of
org.apache.commons.fileupload.FileItem s associated with a given MARKUP
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: AFileUploadBase.java,v 1.3 2003/06/01 00:18:13 martinc Exp $ |
Method Summary | |
protected FileItem | createItem(Map headers, boolean isFormField) Creates a new
FileItem instance.
Parameters: headers - A Map containing the HTTP request headers. Parameters: isFormField - Whether or not this item is a form field, as opposed to a file. | 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(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. | 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) throws FileUploadException(Code) | | Creates a new
FileItem instance.
Parameters: headers - A Map containing the HTTP request headers. Parameters: isFormField - Whether or not this item is a form field, as opposed to a file. A newly created FileItem instance. exception: FileUploadException - if an error occurs. |
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 if therewere 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(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. If files are stored on
disk, the path is given by getRepository() .
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/parsing the request or storingfiles. |
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: AFileUploadBase.getSizeMax() |
|
|