Package com.aspectran.core.adapter
Interface RequestAdapter
- All Known Subinterfaces:
WebRequestAdapter
- All Known Implementing Classes:
AbstractRequestAdapter
,AbstractWebRequestAdapter
,AspectranRequestAdapter
,DaemonRequestAdapter
,DefaultRequestAdapter
,HttpServletRequestAdapter
,QuartzJobRequestAdapter
,ShellRequestAdapter
,TowRequestAdapter
public interface RequestAdapter
The Interface RequestAdapter.
- Since:
- 2011. 3. 13.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given single header value to the current list of values for the given header.boolean
containsHeader
(String name) Returns a boolean indicating whether the named response header has already been set.void
extractAttributes
(Map<String, Object> targetAttributes) Extracts all the attributes and fills in the specified map.void
extractParameters
(Map<String, Object> targetParameters) Extracts all the parameters and fills in the specified map.<T> T
Returns the adaptee object to provide request information.Returns a map of the request parameters that can be modified.<T> T
getAttribute
(String name) Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.Returns a mutable map of the attributes, with attribute names as map keys and attribute value as map value.Returns aCollection
containing the names of the attributes available to this request.getBody()
<T extends Parameters>
TgetBodyAsParameters
(Class<T> requiredType) Returns the name of the character encoding used in the body of this request.getFileParameter
(String name) Returns aFileParameter
object as a given request parameter name, ornull
if the file parameter does not exist.Returns aCollection
ofString
objects containing the names of the file parameters contained in this request.getFileParameterValues
(String name) Returns an array ofFileParameter
objects containing all of the values the given request parameter has, ornull
if the parameter does not exist.Returns the value of the response header with the given name.Returns a map of the request headers that can be modified.Returns the names of the headers of this response.getHeaderValues
(String name) Returns the values of the response header with the given name.Returns the preferredLocale
.long
getParameter
(String name) Returns the value of a request parameter as aString
, ornull
if the parameter does not exist.Return a mutable Map of the request parameters, with parameter names as map keys and parameter values as map values.Returns aCollection
ofString
objects containing the names of the parameters contained in this request.<T extends Parameters>
TgetParameters
(Class<T> requiredType) String[]
getParameterValues
(String name) Returns an array ofString
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.Returns the method used for the request.Returns the request scope in this request.Returns the preferredTimeZone
.boolean
Returns whether the request has attributes.boolean
Returns whether the request has file parameters.boolean
Returns whether it has headers.boolean
Returns whether the request has parameters.boolean
Returns whether the request scope exists in this request.void
putAllAttributes
(Map<String, Object> attributes) Copies all of the mappings from the specified attributes.void
putAllFileParameters
(MultiValueMap<String, FileParameter> fileParameterMap) Copies all of the mappings from the specified file parameters.void
putAllParameters
(ParameterMap parameterMap) Copies all of the mappings from the specified parameters.void
putAllParameters
(MultiValueMap<String, String> multiValueMap) Copies all of the mappings from the specified parameters.void
removeAttribute
(String name) Removes an attribute from this request.void
removeFileParameter
(String name) Removes the file parameter with the specified name.void
setAttribute
(String name, Object value) Stores an attribute in this request.void
void
setEncoding
(String encoding) Overrides the name of the character encoding used in the body of this request.void
setFileParameter
(String name, FileParameter fileParameter) Sets theFileParameter
object to the file parameter with the given name.void
setFileParameter
(String name, FileParameter[] fileParameters) Sets the value to the file parameter with the given name.void
Set the given single header value under the given header name.void
Sets the preferredLocale
.void
setMaxRequestSize
(long maxRequestSize) void
setParameter
(String name, String value) Sets the value to the parameter with the given name.void
setParameter
(String name, String[] values) Sets the value to the parameter with the given name.void
setTimeZone
(TimeZone timeZone) Sets the preferredTimeZone
.
-
Method Details
-
getAdaptee
<T> T getAdaptee()Returns the adaptee object to provide request information.- Type Parameters:
T
- the type of the adaptee object- Returns:
- the adaptee object
-
hasRequestScope
boolean hasRequestScope()Returns whether the request scope exists in this request.- Returns:
- true if request scope exists, false otherwise
-
getRequestScope
RequestScope getRequestScope()Returns the request scope in this request. If the request scope does not exist, it is created.- Returns:
- the request scope
-
getHeader
Returns the value of the response header with the given name.If a response header with the given name exists and contains multiple values, the value that was added first will be returned.
- Parameters:
name
- the name of the response header whose value to return- Returns:
- the value of the response header with the given name,
or
null
if no header with the given name has been set on this response
-
getHeaderValues
Returns the values of the response header with the given name.- Parameters:
name
- the name of the response header whose values to return- Returns:
- a (possibly empty)
Collection
of the values of the response header with the given name
-
getHeaderNames
Returns the names of the headers of this response.- Returns:
- a (possibly empty)
Collection
of the names of the headers of this response
-
containsHeader
Returns a boolean indicating whether the named response header has already been set.- Parameters:
name
- the header name- Returns:
true
if the named response header has already been set;false
otherwise
-
setHeader
Set the given single header value under the given header name.- Parameters:
name
- the header namevalue
- the header value to set
-
addHeader
Add the given single header value to the current list of values for the given header.- Parameters:
name
- the header namevalue
- the header value to be added
-
getHeaderMap
MultiValueMap<String,String> getHeaderMap()Returns a map of the request headers that can be modified.- Returns:
- an
MultiValueMap<String, String>
object, may benull
-
hasHeaders
boolean hasHeaders()Returns whether it has headers.- Returns:
- true if headers exist, false otherwise
-
getAttribute
Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.- Type Parameters:
T
- the generic type- Parameters:
name
- aString
specifying the name of the attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist
-
setAttribute
Stores an attribute in this request.- Parameters:
name
- specifying the name of the attributevalue
- theObject
to be stored
-
getAttributeNames
Returns aCollection
containing the names of the attributes available to this request. This method returns an emptyCollection
if the request has no attributes available to it.- Returns:
- the attribute names
-
removeAttribute
Removes an attribute from this request.- Parameters:
name
- aString
specifying the name of the attribute to remove
-
putAllAttributes
Copies all of the mappings from the specified attributes.- Parameters:
attributes
- the specified attributes
-
extractAttributes
Extracts all the attributes and fills in the specified map.- Parameters:
targetAttributes
- the target attribute map to be filled- Since:
- 2.0.0
-
getAttributeMap
Returns a mutable map of the attributes, with attribute names as map keys and attribute value as map value.- Returns:
- a modifiable map of the attributes
-
hasAttributes
boolean hasAttributes()Returns whether the request has attributes.- Returns:
- true if attributes exists, false otherwise
-
getParameter
Returns the value of a request parameter as aString
, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the parameter- Returns:
- a
String
representing the single value of the parameter - See Also:
-
getParameterValues
Returns an array ofString
objects containing all of the values the given activity's request parameter has, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the parameter- Returns:
- an array of
String
objects containing the parameter's values - See Also:
-
getParameterNames
Collection<String> getParameterNames()Returns aCollection
ofString
objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an emptyEnumeration
.- Returns:
- a
Collection
ofString
objects, eachString
containing the name of a request parameter; or an emptyEnumeration
if the request has no parameters
-
setParameter
Sets the value to the parameter with the given name.- Parameters:
name
- aString
specifying the name of the parametervalue
- aString
representing the single value of the parameter- See Also:
-
setParameter
Sets the value to the parameter with the given name.- Parameters:
name
- aString
specifying the name of the parametervalues
- an array ofString
objects containing the parameter's values- See Also:
-
getAllParameters
Returns a map of the request parameters that can be modified.- Returns:
- an
Map<String, Object>
object, must not benull
-
putAllParameters
Copies all of the mappings from the specified parameters.- Parameters:
parameterMap
- the specified parameters- Since:
- 5.2.3
-
putAllParameters
Copies all of the mappings from the specified parameters.- Parameters:
multiValueMap
- the specified parameters- Since:
- 6.1.2
-
extractParameters
Extracts all the parameters and fills in the specified map.- Parameters:
targetParameters
- the target parameter map to be filled- Since:
- 2.0.0
-
getParameterMap
ParameterMap getParameterMap()Return a mutable Map of the request parameters, with parameter names as map keys and parameter values as map values. If the parameter value type is theString
then map value will be of typeString
. If the parameter value type is theString
array then map value will be of typeString
array.- Returns:
- the mutable parameter map
- Since:
- 1.4.0
-
hasParameters
boolean hasParameters()Returns whether the request has parameters.- Returns:
- true if parameters exists, false otherwise
-
getFileParameter
Returns aFileParameter
object as a given request parameter name, ornull
if the file parameter does not exist.- Parameters:
name
- aString
specifying the name of the file parameter- Returns:
- a
FileParameter
representing the single value of the parameter - See Also:
-
getFileParameterValues
Returns an array ofFileParameter
objects containing all of the values the given request parameter has, ornull
if the parameter does not exist.- Parameters:
name
- aString
specifying the name of the file parameter- Returns:
- an array of
FileParameter
objects containing the parameter's values - See Also:
-
getFileParameterNames
Returns aCollection
ofString
objects containing the names of the file parameters contained in this request. If the request has no parameters, the method returns an emptyCollection
.- Returns:
- a
Collection
ofString
objects, eachString
containing the name of a file parameter; or an emptyCollection
if the request has no file parameters
-
setFileParameter
Sets theFileParameter
object to the file parameter with the given name.- Parameters:
name
- aString
specifying the name of the file parameterfileParameter
- aFileParameter
representing the single value of the parameter- See Also:
-
setFileParameter
Sets the value to the file parameter with the given name.- Parameters:
name
- aString
specifying the name of the file parameterfileParameters
- an array ofFileParameter
objects containing the file parameter's values- See Also:
-
removeFileParameter
Removes the file parameter with the specified name.- Parameters:
name
- aString
specifying the name of the file parameter
-
putAllFileParameters
Copies all of the mappings from the specified file parameters.- Parameters:
fileParameterMap
- the specified file parameters- Since:
- 6.1.2
-
hasFileParameters
boolean hasFileParameters()Returns whether the request has file parameters.- Returns:
- true if file parameters exists, false otherwise
-
getRequestMethod
MethodType getRequestMethod()Returns the method used for the request.- Returns:
- a
MethodType
object
-
getEncoding
String getEncoding()Returns the name of the character encoding used in the body of this request.- Returns:
- a
String
containing the name of the character encoding, ornull
if the request does not specify a character encoding
-
setEncoding
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader(). Otherwise, it has no effect.- Parameters:
encoding
- aString
containing the name of the character encoding.- Throws:
UnsupportedEncodingException
- if the specified encoding is invalid
-
getLocale
Locale getLocale()Returns the preferredLocale
.- Returns:
- a preferred
Locale
-
setLocale
Sets the preferredLocale
.- Parameters:
locale
- a givenLocale
-
getTimeZone
TimeZone getTimeZone()Returns the preferredTimeZone
.- Returns:
- a preferred
TimeZone
-
setTimeZone
Sets the preferredTimeZone
.- Parameters:
timeZone
- a givenTimeZone
-
getMaxRequestSize
long getMaxRequestSize() -
setMaxRequestSize
void setMaxRequestSize(long maxRequestSize) -
getInputStream
- Throws:
IOException
-
getBody
String getBody() -
setBody
-
getBodyAsParameters
- Throws:
RequestParseException
-
getBodyAsParameters
- Throws:
RequestParseException
-
getParameters
Parameters getParameters() -
getParameters
-