Package org.appng.forms
Interface RequestContainer
-
- All Known Implementing Classes:
ApplicationRequest
,RequestBean
public interface RequestContainer
ARequestContainer
conveniently wraps anServletRequest
and simplifies the access to (possibly multi-valued) request-parameters includingFormUpload
s.- Author:
- Matthias Müller
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,List<FormUpload>>
getFormUploads()
Returns allFormUpload
s for the request as immutable map.List<FormUpload>
getFormUploads(String name)
Returns an immutableList
of allFormUpload
s for the parameter with the given name.String
getHost()
Returns the host name for this requestString
getParameter(String name)
Returns the value for the parameter with the given name.
Note that for a multi-valued parameter, any of the submitted values is returned.List<String>
getParameterList(String name)
Returns aList
containing all the values for the parameter with the given name.Set<String>
getParameterNames()
Returns an immutableSet
containing the names of all request parameters.Map<String,String>
getParameters()
Returns an immutableMap
containing the name of each request-parameter as a key and a single parameter value as the map's value.
Note that for multi-valued parameters, the returned map contains any of the submitted values.Map<String,List<String>>
getParametersList()
Returns an immutableMap
containing the name of each request-parameter as a key and the list of submitted values as value.boolean
hasParameter(String name)
Checks whether a parameter with the given name exists.
-
-
-
Method Detail
-
getHost
String getHost()
Returns the host name for this request- Returns:
- the host name
-
getParametersList
Map<String,List<String>> getParametersList()
Returns an immutableMap
containing the name of each request-parameter as a key and the list of submitted values as value.- Returns:
- a
Map
containing the request parameters (including multi-valued ones)
-
getParameters
Map<String,String> getParameters()
Returns an immutableMap
containing the name of each request-parameter as a key and a single parameter value as the map's value.
Note that for multi-valued parameters, the returned map contains any of the submitted values. UsegetParametersList()
instead if you want to deal with multi-valued parameters.- Returns:
- a
Map
containing the request parameters
-
getParameter
String getParameter(String name)
Returns the value for the parameter with the given name.
Note that for a multi-valued parameter, any of the submitted values is returned. UsegetParameterList(String)
instead if you want to deal with a multi-valued parameter.- Parameters:
name
- the name of the parameter- Returns:
- the value of the parameter (may be null)
-
getParameterNames
Set<String> getParameterNames()
Returns an immutableSet
containing the names of all request parameters.- Returns:
- the parameters names
-
hasParameter
boolean hasParameter(String name)
Checks whether a parameter with the given name exists.- Parameters:
name
- the name of the parameter- Returns:
true
if such a parameter exists,false
otherwise
-
getParameterList
List<String> getParameterList(String name)
Returns aList
containing all the values for the parameter with the given name.- Parameters:
name
- the name of the parameter- Returns:
- a
List
(nevernull
, but may be empty) containing all the values for the given parameter
-
getFormUploads
Map<String,List<FormUpload>> getFormUploads()
Returns allFormUpload
s for the request as immutable map. Returns aMap
using the parameters name as a key and aList
ofFormUpload
s as the value.- Returns:
- a
Map
containing theFileUpload
s
-
getFormUploads
List<FormUpload> getFormUploads(String name)
Returns an immutableList
of allFormUpload
s for the parameter with the given name.- Parameters:
name
- the name of the parameters- Returns:
- a list if
FormUpload
s (nevernull
, but may be empty)
-
-