| java.lang.Object org.apache.wicket.util.upload.FileUploadBase
All known Subclasses: org.apache.wicket.util.upload.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.
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 |
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 afile. | protected byte[] | getBoundary(String contentType) Retrieves the boundary from the Content-type header.
Parameters: contentType - The value of the content type header from which to extract theboundary 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. | 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(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 request headers. Parameters: isFormField - Whether or not this item is a form field, as opposed to afile. A newly created FileItem instance. |
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 to extract theboundary 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 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(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. |
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(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/parsing the request orstoring 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() |
|
|