public interface RequestParser
This parser lets extract parameters from an HttpServletRequest
.
These parameters can be indeed provided in several ways. Among these ways,
application/x-www-form-urlencoded and multipart/form-data are the most famous.
Both are already fully supported by the UWS library by default in UWSParameters
.
IMPORTANT:
A RequestParser
extension MUST NOT be used to check the parameters' value.
It only aims to parse an HttpServletRequest
in order to extract parameters.
UWSParameters
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
parse(javax.servlet.http.HttpServletRequest request)
Extract parameters from the given HTTP request.
|
java.util.Map<java.lang.String,java.lang.Object> parse(javax.servlet.http.HttpServletRequest request) throws UWSException
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
.
request
- An HTTP request.Object
s (in which types can be mixed).UWSException
- If any error provides this function to read the parameters.