Package com.aspectran.core.adapter
Interface RequestAdapter
-
- All Known Implementing Classes:
AbstractRequestAdapter,DefaultRequestAdapter,QuartzJobRequestAdapter
public interface RequestAdapterThe Interface RequestAdapter.- Since:
- 2011. 3. 13.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddHeader(java.lang.String name, java.lang.String value)Add the given single header value to the current list of values for the given header.booleancontainsHeader(java.lang.String name)Returns a boolean indicating whether the named response header has already been set.voidextractAttributes(java.util.Map<java.lang.String,java.lang.Object> targetAttributes)Extracts all the attributes and fills in the specified map.voidextractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)Extracts all the parameters and fills in the specified map.<T> TgetAdaptee()Returns the adaptee object to provide request information.java.util.Map<java.lang.String,java.lang.Object>getAllParameters()Returns a map of the request parameters that can be modified.<T> TgetAttribute(java.lang.String name)Returns the value of the named attribute as a given type, ornullif no attribute of the given name exists.java.util.Map<java.lang.String,java.lang.Object>getAttributeMap()Returns an mutable map of the attributes, with attribute names as map keys and attribute value as map value.java.util.Set<java.lang.String>getAttributeNames()Returns aCollectioncontaining the names of the attributes available to this request.java.lang.StringgetBody()ParametersgetBodyAsParameters()<T extends Parameters>
TgetBodyAsParameters(java.lang.Class<T> requiredType)java.lang.StringgetEncoding()Returns the name of the character encoding used in the body of this request.FileParametergetFileParameter(java.lang.String name)Returns aFileParameterobject as a given request parameter name, ornullif the file parameter does not exist.java.util.Set<java.lang.String>getFileParameterNames()Returns aCollectionofStringobjects containing the names of the file parameters contained in this request.FileParameter[]getFileParameterValues(java.lang.String name)Returns an array ofFileParameterobjects containing all of the values the given request parameter has, ornullif the parameter does not exist.java.lang.StringgetHeader(java.lang.String name)Returns the value of the response header with the given name.MultiValueMap<java.lang.String,java.lang.String>getHeaderMap()Returns a map of the request headers that can be modified.java.util.Set<java.lang.String>getHeaderNames()Returns the names of the headers of this response.java.util.List<java.lang.String>getHeaderValues(java.lang.String name)Returns the values of the response header with the given name.java.io.InputStreamgetInputStream()java.util.LocalegetLocale()Returns the preferredLocale.longgetMaxRequestSize()java.lang.StringgetParameter(java.lang.String name)Returns the value of a request parameter as aString, ornullif the parameter does not exist.ParameterMapgetParameterMap()Return an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values.java.util.Collection<java.lang.String>getParameterNames()Returns aCollectionofStringobjects containing the names of the parameters contained in this request.ParametersgetParameters()<T extends Parameters>
TgetParameters(java.lang.Class<T> requiredType)java.lang.String[]getParameterValues(java.lang.String name)Returns an array ofStringobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.MethodTypegetRequestMethod()Returns the method used for the request.RequestScopegetRequestScope()Gets the request scope.RequestScopegetRequestScope(boolean create)Gets the request scope.java.util.TimeZonegetTimeZone()Returns the preferredTimeZone.booleanhasAttributes()Returns whether the request has attributes.booleanhasFileParameters()Returns whether the request has file parameters.booleanhasHeaders()Returns whether it has headers.booleanhasParameters()Returns whether the request has parameters.voidputAllAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)Copies all of the mappings from the specified attributes.voidputAllFileParameters(MultiValueMap<java.lang.String,FileParameter> fileParameterMap)Copies all of the mappings from the specified file parameters.voidputAllParameters(ParameterMap parameterMap)Copies all of the mappings from the specified parameters.voidputAllParameters(MultiValueMap<java.lang.String,java.lang.String> parameterMap)Copies all of the mappings from the specified parameters.voidremoveAttribute(java.lang.String name)Removes an attribute from this request.voidremoveFileParameter(java.lang.String name)Removes the file parameter with the specified name.voidsetAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this request.voidsetBody(java.lang.String body)voidsetEncoding(java.lang.String encoding)Overrides the name of the character encoding used in the body of this request.voidsetFileParameter(java.lang.String name, FileParameter fileParameter)Sets theFileParameterobject to the file parameter with the given name.voidsetFileParameter(java.lang.String name, FileParameter[] fileParameters)Sets the value to the file parameter with the given name.voidsetHeader(java.lang.String name, java.lang.String value)Set the given single header value under the given header name.voidsetLocale(java.util.Locale locale)Sets the preferredLocale.voidsetMaxRequestSize(long maxRequestSize)voidsetParameter(java.lang.String name, java.lang.String value)Sets the value to the parameter with the given name.voidsetParameter(java.lang.String name, java.lang.String[] values)Sets the value to the parameter with the given name.voidsetTimeZone(java.util.TimeZone timeZone)Sets the preferredTimeZone.
-
-
-
Method Detail
-
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
-
getRequestScope
RequestScope getRequestScope()
Gets the request scope.- Returns:
- the request scope
-
getRequestScope
RequestScope getRequestScope(boolean create)
Gets the request scope.- Parameters:
create-trueto create a new request scope for this request if necessary;falseto returnnull- Returns:
- the request scope
-
getHeader
java.lang.String getHeader(java.lang.String name)
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
nullif no header with the given name has been set on this response
-
getHeaderValues
java.util.List<java.lang.String> getHeaderValues(java.lang.String name)
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)
Collectionof the values of the response header with the given name
-
getHeaderNames
java.util.Set<java.lang.String> getHeaderNames()
Returns the names of the headers of this response.- Returns:
- a (possibly empty)
Collectionof the names of the headers of this response
-
containsHeader
boolean containsHeader(java.lang.String name)
Returns a boolean indicating whether the named response header has already been set.- Parameters:
name- the header name- Returns:
trueif the named response header has already been set;falseotherwise
-
setHeader
void setHeader(java.lang.String name, java.lang.String value)Set the given single header value under the given header name.- Parameters:
name- the header namevalue- the header value to set
-
addHeader
void addHeader(java.lang.String name, java.lang.String value)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<java.lang.String,java.lang.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
-
getParameter
java.lang.String getParameter(java.lang.String name)
Returns the value of a request parameter as aString, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting the single value of the parameter - See Also:
getParameterValues(java.lang.String)
-
getParameterValues
java.lang.String[] getParameterValues(java.lang.String name)
Returns an array ofStringobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- an array of
Stringobjects containing the parameter's values - See Also:
getParameter(java.lang.String)
-
getParameterNames
java.util.Collection<java.lang.String> getParameterNames()
Returns aCollectionofStringobjects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an emptyEnumeration.- Returns:
- a
CollectionofStringobjects, eachStringcontaining the name of a request parameter; or an emptyEnumerationif the request has no parameters
-
setParameter
void setParameter(java.lang.String name, java.lang.String value)Sets the value to the parameter with the given name.- Parameters:
name- aStringspecifying the name of the parametervalue- aStringrepresenting the single value of the parameter- See Also:
setParameter(String, String[])
-
setParameter
void setParameter(java.lang.String name, java.lang.String[] values)Sets the value to the parameter with the given name.- Parameters:
name- aStringspecifying the name of the parametervalues- an array ofStringobjects containing the parameter's values- See Also:
setParameter(java.lang.String, java.lang.String)
-
getAllParameters
java.util.Map<java.lang.String,java.lang.Object> getAllParameters()
Returns a map of the request parameters that can be modified.- Returns:
- an
Map<String, Object>object, must not benull
-
putAllParameters
void putAllParameters(ParameterMap parameterMap)
Copies all of the mappings from the specified parameters.- Parameters:
parameterMap- the specified parameters- Since:
- 5.2.3
-
putAllParameters
void putAllParameters(MultiValueMap<java.lang.String,java.lang.String> parameterMap)
Copies all of the mappings from the specified parameters.- Parameters:
parameterMap- the specified parameters- Since:
- 6.1.2
-
extractParameters
void extractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)
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 an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values. If the parameter value type is theStringthen map value will be of typeString. If the parameter value type is theStringarray then map value will be of typeStringarray.- 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
FileParameter getFileParameter(java.lang.String name)
Returns aFileParameterobject as a given request parameter name, ornullif the file parameter does not exist.- Parameters:
name- aStringspecifying the name of the file parameter- Returns:
- a
FileParameterrepresenting the single value of the parameter - See Also:
getFileParameterValues(java.lang.String)
-
getFileParameterValues
FileParameter[] getFileParameterValues(java.lang.String name)
Returns an array ofFileParameterobjects containing all of the values the given request parameter has, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the file parameter- Returns:
- an array of
FileParameterobjects containing the parameter's values - See Also:
getFileParameter(java.lang.String)
-
getFileParameterNames
java.util.Set<java.lang.String> getFileParameterNames()
Returns aCollectionofStringobjects containing the names of the file parameters contained in this request. If the request has no parameters, the method returns an emptyCollection.- Returns:
- a
CollectionofStringobjects, eachStringcontaining the name of a file parameter; or an emptyCollectionif the request has no file parameters
-
setFileParameter
void setFileParameter(java.lang.String name, FileParameter fileParameter)Sets theFileParameterobject to the file parameter with the given name.- Parameters:
name- aStringspecifying the name of the file parameterfileParameter- aFileParameterrepresenting the single value of the parameter- See Also:
setFileParameter(String, FileParameter[])
-
setFileParameter
void setFileParameter(java.lang.String name, FileParameter[] fileParameters)Sets the value to the file parameter with the given name.- Parameters:
name- aStringspecifying the name of the file parameterfileParameters- an array ofFileParameterobjects containing the file parameter's values- See Also:
setFileParameter(java.lang.String, com.aspectran.core.activity.request.FileParameter)
-
removeFileParameter
void removeFileParameter(java.lang.String name)
Removes the file parameter with the specified name.- Parameters:
name- aStringspecifying the name of the file parameter
-
putAllFileParameters
void putAllFileParameters(MultiValueMap<java.lang.String,FileParameter> fileParameterMap)
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
-
getAttribute
<T> T getAttribute(java.lang.String name)
Returns the value of the named attribute as a given type, ornullif no attribute of the given name exists.- Type Parameters:
T- the generic type- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this request.- Parameters:
name- specifying the name of the attributevalue- theObjectto be stored
-
getAttributeNames
java.util.Set<java.lang.String> getAttributeNames()
Returns aCollectioncontaining the names of the attributes available to this request. This method returns an emptyCollectionif the request has no attributes available to it.- Returns:
- the attribute names
-
removeAttribute
void removeAttribute(java.lang.String name)
Removes an attribute from this request.- Parameters:
name- aStringspecifying the name of the attribute to remove
-
putAllAttributes
void putAllAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Copies all of the mappings from the specified attributes.- Parameters:
attributes- the specified attributes
-
extractAttributes
void extractAttributes(java.util.Map<java.lang.String,java.lang.Object> targetAttributes)
Extracts all the attributes and fills in the specified map.- Parameters:
targetAttributes- the target attribute map to be filled- Since:
- 2.0.0
-
getAttributeMap
java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
Returns an mutable map of the attributes, with attribute names as map keys and attribute value as map value.- Returns:
- an modifiable map of the attributes
-
hasAttributes
boolean hasAttributes()
Returns whether the request has attributes.- Returns:
- true if attributes exists, false otherwise
-
getRequestMethod
MethodType getRequestMethod()
Returns the method used for the request.- Returns:
- a
MethodTypeobject
-
getEncoding
java.lang.String getEncoding()
Returns the name of the character encoding used in the body of this request.- Returns:
- a
Stringcontaining the name of the character encoding, ornullif the request does not specify a character encoding
-
setEncoding
void setEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingExceptionOverrides 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- aStringcontaining the name of the character encoding.- Throws:
java.io.UnsupportedEncodingException- if the specified encoding is invalid
-
getLocale
java.util.Locale getLocale()
Returns the preferredLocale.- Returns:
- a preferred
Locale
-
setLocale
void setLocale(java.util.Locale locale)
Sets the preferredLocale.- Parameters:
locale- a givenLocale
-
getTimeZone
java.util.TimeZone getTimeZone()
Returns the preferredTimeZone.- Returns:
- a preferred
TimeZone
-
setTimeZone
void setTimeZone(java.util.TimeZone timeZone)
Sets the preferredTimeZone.- Parameters:
timeZone- a givenTimeZone
-
getMaxRequestSize
long getMaxRequestSize()
-
setMaxRequestSize
void setMaxRequestSize(long maxRequestSize)
-
getInputStream
java.io.InputStream getInputStream() throws java.io.IOException- Throws:
java.io.IOException
-
getBody
java.lang.String getBody()
-
setBody
void setBody(java.lang.String body)
-
getBodyAsParameters
Parameters getBodyAsParameters() throws RequestParseException
- Throws:
RequestParseException
-
getBodyAsParameters
<T extends Parameters> T getBodyAsParameters(java.lang.Class<T> requiredType) throws RequestParseException
- Throws:
RequestParseException
-
getParameters
Parameters getParameters()
-
getParameters
<T extends Parameters> T getParameters(java.lang.Class<T> requiredType)
-
-