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(RequestContext) to acquire a list of org.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.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | ATTACHMENT
Content-disposition value for file attachment. |
| public static final String | CONTENT_DISPOSITION
HTTP content disposition header name. |
| public static final String | CONTENT_LENGTH
HTTP content length header name. |
| public static final String | CONTENT_TYPE
HTTP content type header name. |
| private long | fileCountMax
The maximum permitted number of files that may be uploaded in a single request. |
| private long | fileSizeMax
The maximum size permitted for a single uploaded file, as opposed
to |
| public static final String | FORM_DATA
Content-disposition value for form data. |
| private String | headerEncoding
The content encoding to use when reading part headers. |
| private ProgressListener | listener
The progress listener. |
| 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. |
| private long | sizeMax
The maximum size permitted for the complete request, as opposed to
|
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | Returns: The boundary, as a byte array.The value of the content type header from which to
extract the boundary value. contentType)Retrieves the boundary from the |
| public String | Returns: The field name for the currentencapsulation.A headers)Map containing the HTTP request headers.Retrieves the field name from the |
| private String | Returns: The field jakeThe content-dispositions header value. pContentDisposition)Returns the field name, which is given by the content-disposition header. |
| public long | Returns: The maximum number of files allowed in a single request.Returns the maximum number of files allowed in a single request. |
| public abstract FileItemFactory | Returns: The factory class for new file items.Returns the factory class used when creating file items. |
| public String | Returns: The file name for the currentencapsulation.The HTTP headers object. headers)Retrieves the file name from the |
| private String | Returns: The file nameThe content-disposition headers value. pContentDisposition)Returns the given content-disposition headers file name. |
| public long | Returns: Maximum size of a single uploaded file.Returns the maximum allowed size of a single uploaded file,
as opposed to |
| public String | Returns: The encoding used to read part headers.Retrieves the character encoding used when reading the headers of an individual part. |
| public FileItemIterator | Returns: An iterator to instances ofFileItemStream
parsed from the request, in the order that they were
transmitted.The context for the request to be parsed. ctx)Processes an RFC 1867
compliant |
| public FileItemHeaders | Returns: AMap containing the parsed HTTP request headers.The headerPart)header-part of the current
encapsulation. Parses the |
| public ProgressListener | |
| public long | Returns: The maximum allowed size, in bytes. The default value of -1 indicates, that there is no limit.Returns the maximum allowed size of a complete request, as opposed
to |
| protected FileItemHeadersImpl | |
| private int | Returns: Index of the \r\n sequence, which indicates end of line.The headers, which are being parsed. headerPart, final int Index of the last byte, which has yet been
processed. end)Skips bytes until the end of the current line. |
| private void | parseHeaderLine(final FileItemHeadersImpl
String with all headers. headers, final String Map where to store the current header. header)Reads the next header line. |
| public List | Returns: A list ofFileItem instances parsed from the
request, in the order that they were transmitted.The context for the request to be parsed. ctx)Processes an RFC 1867
compliant |
| public void | setFileCountMax(final long
The new limit. fileCountMax)-1 means no limit.Sets the maximum number of files allowed per request. |
| public abstract void | setFileItemFactory(FileItemFactory
The factory class for new file items. factory)Sets the factory class to use when creating file items. |
| public void | setFileSizeMax(final long
Maximum size of a single uploaded file. fileSizeMax)Sets the maximum allowed size of a single uploaded file,
as opposed to |
| public void | setHeaderEncoding(final String
The encoding used to read part headers. encoding)Specifies the character encoding to be used when reading the headers of individual part. |
| public void | setProgressListener(final ProgressListener
The progress listener, if any. Defaults to null. pListener)Sets the progress listener. |
| public void | setSizeMax(final long
The maximum allowed size, in bytes. The default value of
-1 indicates, that there is no limit. sizeMax)Sets the maximum allowed size of a complete request, as opposed
to |
| ATTACHMENT | back to summary |
|---|---|
| public static final String ATTACHMENT Content-disposition value for file attachment. | |
| CONTENT_DISPOSITION | back to summary |
|---|---|
| public static final String CONTENT_DISPOSITION HTTP content disposition header name. | |
| CONTENT_LENGTH | back to summary |
|---|---|
| public static final String CONTENT_LENGTH HTTP content length header name. | |
| CONTENT_TYPE | back to summary |
|---|---|
| public static final String CONTENT_TYPE HTTP content type header name. | |
| fileCountMax | back to summary |
|---|---|
| private long fileCountMax The maximum permitted number of files that may be uploaded in a single request. A value of -1 indicates no maximum. | |
| fileSizeMax | back to summary |
|---|---|
| private long fileSizeMax The maximum size permitted for a single uploaded file, as opposed
to | |
| FORM_DATA | back to summary |
|---|---|
| public static final String FORM_DATA Content-disposition value for form data. | |
| headerEncoding | back to summary |
|---|---|
| private String headerEncoding The content encoding to use when reading part headers. | |
| listener | back to summary |
|---|---|
| private ProgressListener listener The progress listener. | |
| MULTIPART | back to summary |
|---|---|
| public static final String MULTIPART Part of HTTP content type header. | |
| MULTIPART_FORM_DATA | back to summary |
|---|---|
| public static final String MULTIPART_FORM_DATA HTTP content type header for multipart forms. | |
| MULTIPART_MIXED | back to summary |
|---|---|
| public static final String MULTIPART_MIXED HTTP content type header for multiple uploads. | |
| sizeMax | back to summary |
|---|---|
| private long sizeMax The maximum size permitted for the complete request, as opposed to
| |
| FileUploadBase | back to summary |
|---|---|
| public FileUploadBase() | |
| getBoundary | back to summary |
|---|---|
| public byte[] getBoundary(final String contentType) Retrieves the boundary from the
| |
| getFieldName | back to summary |
|---|---|
| public String getFieldName(final FileItemHeaders headers) Retrieves the field name from the
| |
| getFieldName | back to summary |
|---|---|
| private String getFieldName(final String pContentDisposition) Returns the field name, which is given by the content-disposition header. | |
| getFileCountMax | back to summary |
|---|---|
| public long getFileCountMax() Returns the maximum number of files allowed in a single request.
| |
| getFileItemFactory | back to summary |
|---|---|
| public abstract FileItemFactory getFileItemFactory() Returns the factory class used when creating file items.
| |
| getFileName | back to summary |
|---|---|
| public String getFileName(final FileItemHeaders headers) Retrieves the file name from the
| |
| getFileName | back to summary |
|---|---|
| private String getFileName(final String pContentDisposition) Returns the given content-disposition headers file name. | |
| getFileSizeMax | back to summary |
|---|---|
| public long getFileSizeMax() Returns the maximum allowed size of a single uploaded file,
as opposed to
| |
| getHeaderEncoding | back to summary |
|---|---|
| public String getHeaderEncoding() Retrieves the character encoding used when reading the headers of an
individual part. When not specified, or
| |
| getItemIterator | back to summary |
|---|---|
| public FileItemIterator getItemIterator(final RequestContext ctx) throws FileUploadException, IOException Processes an RFC 1867
compliant
| |
| getParsedHeaders | back to summary |
|---|---|
| public FileItemHeaders getParsedHeaders(final String headerPart) Parses the If there are multiple headers of the same names, the name will map to a comma-separated list containing the values.
| |
| getProgressListener | back to summary |
|---|---|
| public ProgressListener getProgressListener() Returns the progress listener.
| |
| getSizeMax | back to summary |
|---|---|
| public long getSizeMax() Returns the maximum allowed size of a complete request, as opposed
to
| |
| newFileItemHeaders | back to summary |
|---|---|
| protected FileItemHeadersImpl newFileItemHeaders() Creates a new instance of
| |
| parseEndOfLine | back to summary |
|---|---|
| private int parseEndOfLine(final String headerPart, final int end) Skips bytes until the end of the current line.
| |
| parseHeaderLine | back to summary |
|---|---|
| private void parseHeaderLine(final FileItemHeadersImpl headers, final String header) Reads the next header line.
| |
| parseRequest | back to summary |
|---|---|
| public List Processes an RFC 1867
compliant
| |
| setFileCountMax | back to summary |
|---|---|
| public void setFileCountMax(final long fileCountMax) Sets the maximum number of files allowed per request.
| |
| setFileItemFactory | back to summary |
|---|---|
| public abstract void setFileItemFactory(FileItemFactory factory) Sets the factory class to use when creating file items.
| |
| setFileSizeMax | back to summary |
|---|---|
| public void setFileSizeMax(final long fileSizeMax) Sets the maximum allowed size of a single uploaded file,
as opposed to
| |
| setHeaderEncoding | back to summary |
|---|---|
| public void setHeaderEncoding(final String encoding) Specifies the character encoding to be used when reading the headers of
individual part. When not specified, or
| |
| setProgressListener | back to summary |
|---|---|
| public void setProgressListener(final ProgressListener pListener) Sets the progress listener.
| |
| setSizeMax | back to summary |
|---|---|
| public void setSizeMax(final long sizeMax) Sets the maximum allowed size of a complete request, as opposed
to
| |