public final class UWSRequestParser extends java.lang.Object implements RequestParser
FormEncodedParser
MultipartParser
XMLRequestParser
(the whole request body is an XML document)
The request body size is limited for the multipart AND the XML-Request
parsers. If you want to change this limit, you MUST do it for each of these
parsers, setting the following static attributes: resp.
MultipartParser.SIZE_LIMIT
and XMLRequestParser.SIZE_LIMIT
(and also XMLRequestParser.SMALL_XML_THRESHOLD
).
Note:
If you want to change the support other request parsing, you will have to
write your own RequestParser
implementation.
Constructor and Description |
---|
UWSRequestParser(UWSFileManager fileManager)
Build a
RequestParser able to choose the most appropriate
RequestParser in function of the request content-type. |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
parse(javax.servlet.http.HttpServletRequest req)
Extract parameters from the given HTTP request.
|
public UWSRequestParser(UWSFileManager fileManager)
RequestParser
able to choose the most appropriate
RequestParser
in function of the request content-type.fileManager
- The file manager to use in order to store any
eventual upload. Must NOT be NULL.public java.util.Map<java.lang.String,java.lang.Object> parse(javax.servlet.http.HttpServletRequest req) throws UWSException
RequestParser
Extract parameters from the given HTTP request.
These parameters can be fetched from ServletRequest.getParameterMap()
or directly from the full request content. In this last case, a parsing is necessary ;
hence this function.
In case a parameter is provided several times with the same time and the same case,
the request parser can choose to keep only the last occurrence or all occurrences.
If all occurrences are kept, this function MUST return an array of Object
s
(in which types may be mixed), otherwise a map value MUST be an elementary object.
Note: A parameter item can be a simple value (e.g. String, integer, ...) or a more complex object (e.g. File, InputStream, ...).
IMPORTANT:
This function MUST NOT be used to check the parameters' value.
It only aims to parse the given request in order to extract its embedded parameters.
Consequently, if this function throws an exception, it could be only because the request
can not be read, and not because a parameter format or value is incorrect.
Parameter checks should be done in UWSParameters
and more particularly by
an InputParamController
.
parse
in interface RequestParser
req
- An HTTP request.Object
s (in which types can be mixed).UWSException
- If any error provides this function to read the parameters.