|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.nimbox.http.MultipartRequestParser
public class MultipartRequestParser
This class is used to interpret HttpServletRequests whose content
type indicate a multipart/form-data
request. The
implementation of this class reads any incoming files which are
then saved directly to disk to a location that you can set.
This class can receive arbitrarily large files (up to an artificial limit that can be configured). It cannot handle nested data (multipart content within multipart content). It can also handle internationalized content (such as non Latin-1 filenames).
To avoid collisions and have fine control over file placement, the init method of the class can include a reference to a FileRenamePolicy implementation. A particular policy can choose to rename or change the location of the file before it's written.
Field Summary | |
---|---|
static java.lang.String |
BUFFERED
Key used to retrieve from the initialization settings the flag indicating weather this parser should do internal buffering or let the server handle the buffering. |
static java.lang.String |
CHAR_ENCODING
Key used to retrieve from the initialization settings the encoding for the response. |
static java.lang.String |
FILE_RENAME_POLICY
Key used to retrieve from the initialization settings the file rename policy to be used by the parseRequest() method before saving the file to disk. |
static java.lang.String |
LIMIT_LENGTH
Key used to retrieve from the initialization settings the flag indicating that the parseRequest() method needs to filter the request's input stream to prevent trying to read past the end of the stream. |
static java.lang.String |
MAX_POST_SIZE
Key used to retrieve from the initialization settings the max post size allowed. |
static java.lang.String |
SAVE_DIRECTORY
Key used to retrieve from the initialization settings the directory location where uploaded files are cached. |
Constructor Summary | |
---|---|
MultipartRequestParser()
Class constructor. |
Method Summary | |
---|---|
void |
init(java.util.HashMap settings)
This method is used to initialize this request parser. |
java.util.HashMap |
parseRequest(javax.servlet.http.HttpServletRequest request)
This method parses an Http request that has the following content type: multipart/form-data . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SAVE_DIRECTORY
public static final java.lang.String CHAR_ENCODING
public static final java.lang.String MAX_POST_SIZE
public static final java.lang.String BUFFERED
public static final java.lang.String LIMIT_LENGTH
public static final java.lang.String FILE_RENAME_POLICY
Constructor Detail |
---|
public MultipartRequestParser()
Method Detail |
---|
public void init(java.util.HashMap settings)
init
in interface RequestParser
settings
- A HashMap containing the initialization parameters for this
parser: This implementation requires the following
initialization parameters:
MultipartRequestParser.SAVE_DIRECTORY:
The directory location where uploaded files are placed.
This parameters is a mandatory settings and an
IllegalArgumentException is thrown if this parameter is
not available.MultipartRequestParser.CHAR_ENCODING:
The
encoding of the response, such as "ISO-8859-1". If this
parameter is not in the settings a default encoding is
used ("ISO-8859-1").MultipartRequestParser.MAX_POST_SIZE:
The
max post size accepted for the request. If this parameter
is not set, a default max post size of 1Mb is used.MultipartRequestParser.BUFFERED:
A
boolean flag indicating weather this parser should handle
internal buffering or let the server handle the buffering.
If this parameter is not set, the flag is set to
true.MultipartRequestParser.LIMIT_LENGTH:
A
boolean flag indicating that this parser needs to filter
the request's input stream to prevent trying to read past
the end of the stream. If this parameter is not set, the
flag is set to true.MultipartRequestParser.FILE_RENAME_POLICY:
The rename policy implementation to use. If this
parameter is not set, the DefaultFileRenamePolicy
implementation is used. The default rename policy object
will append a number to the filename before the file is
stored in the file system.java.lang.IllegalArgumentException
- If any of the initialization settings are not valid.public java.util.HashMap parseRequest(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
multipart/form-data
. Any uploaded
files are written to a given location in the file system.
parseRequest
in interface RequestParser
request
- Reference to the HttpServletRequest to be parsed.
NimletInput.UPLOADED_FILES
key of
the returned HashMap.
java.io.IOException
- If unable to:
java.lang.IllegalArgumentException
- If the given request parameter is null
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.