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 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

      String getHeader(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 null if no header with the given name has been set on this response
    • getHeaderValues

      List<String> getHeaderValues(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) Collection of the values of the response header with the given name
    • getHeaderNames

      Set<String> 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

      boolean containsHeader(String name)
      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

      void setHeader(String name, String value)
      Set the given single header value under the given header name.
      Parameters:
      name - the header name
      value - the header value to set
    • addHeader

      void addHeader(String name, String value)
      Add the given single header value to the current list of values for the given header.
      Parameters:
      name - the header name
      value - 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 be null
    • hasHeaders

      boolean hasHeaders()
      Returns whether it has headers.
      Returns:
      true if headers exist, false otherwise
    • getAttribute

      <T> T getAttribute(String name)
      Returns the value of the named attribute as a given type, or null if no attribute of the given name exists.
      Type Parameters:
      T - the generic type
      Parameters:
      name - a String specifying the name of the attribute
      Returns:
      an Object containing the value of the attribute, or null if the attribute does not exist
    • setAttribute

      void setAttribute(String name, Object value)
      Stores an attribute in this request.
      Parameters:
      name - specifying the name of the attribute
      value - the Object to be stored
    • getAttributeNames

      Set<String> getAttributeNames()
      Returns a Collection containing the names of the attributes available to this request. This method returns an empty Collection if the request has no attributes available to it.
      Returns:
      the attribute names
    • removeAttribute

      void removeAttribute(String name)
      Removes an attribute from this request.
      Parameters:
      name - a String specifying the name of the attribute to remove
    • putAllAttributes

      void putAllAttributes(Map<String,Object> attributes)
      Copies all of the mappings from the specified attributes.
      Parameters:
      attributes - the specified attributes
    • extractAttributes

      void extractAttributes(Map<String,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

      Map<String,Object> 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

      String getParameter(String name)
      Returns the value of a request parameter as a String, or null if the parameter does not exist.
      Parameters:
      name - a String specifying the name of the parameter
      Returns:
      a String representing the single value of the parameter
      See Also:
    • getParameterValues

      String[] getParameterValues(String name)
      Returns an array of String objects containing all of the values the given activity's request parameter has, or null if the parameter does not exist.
      Parameters:
      name - a String specifying the name of the parameter
      Returns:
      an array of String objects containing the parameter's values
      See Also:
    • getParameterNames

      Collection<String> getParameterNames()
      Returns a Collection of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.
      Returns:
      a Collection of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters
    • setParameter

      void setParameter(String name, String value)
      Sets the value to the parameter with the given name.
      Parameters:
      name - a String specifying the name of the parameter
      value - a String representing the single value of the parameter
      See Also:
    • setParameter

      void setParameter(String name, String[] values)
      Sets the value to the parameter with the given name.
      Parameters:
      name - a String specifying the name of the parameter
      values - an array of String objects containing the parameter's values
      See Also:
    • getAllParameters

      Map<String,Object> getAllParameters()
      Returns a map of the request parameters that can be modified.
      Returns:
      an Map<String, Object> object, must not be null
    • 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<String,String> multiValueMap)
      Copies all of the mappings from the specified parameters.
      Parameters:
      multiValueMap - the specified parameters
      Since:
      6.1.2
    • extractParameters

      void extractParameters(Map<String,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 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 the String then map value will be of type String. If the parameter value type is the String array then map value will be of type String 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

      FileParameter getFileParameter(String name)
      Returns a FileParameter object as a given request parameter name, or null if the file parameter does not exist.
      Parameters:
      name - a String specifying the name of the file parameter
      Returns:
      a FileParameter representing the single value of the parameter
      See Also:
    • getFileParameterValues

      FileParameter[] getFileParameterValues(String name)
      Returns an array of FileParameter objects containing all of the values the given request parameter has, or null if the parameter does not exist.
      Parameters:
      name - a String specifying the name of the file parameter
      Returns:
      an array of FileParameter objects containing the parameter's values
      See Also:
    • getFileParameterNames

      Set<String> getFileParameterNames()
      Returns a Collection of String objects containing the names of the file parameters contained in this request. If the request has no parameters, the method returns an empty Collection.
      Returns:
      a Collection of String objects, each String containing the name of a file parameter; or an empty Collection if the request has no file parameters
    • setFileParameter

      void setFileParameter(String name, FileParameter fileParameter)
      Sets the FileParameter object to the file parameter with the given name.
      Parameters:
      name - a String specifying the name of the file parameter
      fileParameter - a FileParameter representing the single value of the parameter
      See Also:
    • setFileParameter

      void setFileParameter(String name, FileParameter[] fileParameters)
      Sets the value to the file parameter with the given name.
      Parameters:
      name - a String specifying the name of the file parameter
      fileParameters - an array of FileParameter objects containing the file parameter's values
      See Also:
    • removeFileParameter

      void removeFileParameter(String name)
      Removes the file parameter with the specified name.
      Parameters:
      name - a String specifying the name of the file parameter
    • putAllFileParameters

      void putAllFileParameters(MultiValueMap<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
    • 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, or null if the request does not specify a character encoding
    • setEncoding

      void setEncoding(String encoding) throws UnsupportedEncodingException
      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 - a String containing the name of the character encoding.
      Throws:
      UnsupportedEncodingException - if the specified encoding is invalid
    • getLocale

      Locale getLocale()
      Returns the preferred Locale.
      Returns:
      a preferred Locale
    • setLocale

      void setLocale(Locale locale)
      Sets the preferred Locale.
      Parameters:
      locale - a given Locale
    • getTimeZone

      TimeZone getTimeZone()
      Returns the preferred TimeZone.
      Returns:
      a preferred TimeZone
    • setTimeZone

      void setTimeZone(TimeZone timeZone)
      Sets the preferred TimeZone.
      Parameters:
      timeZone - a given TimeZone
    • getMaxRequestSize

      long getMaxRequestSize()
    • setMaxRequestSize

      void setMaxRequestSize(long maxRequestSize)
    • getInputStream

      InputStream getInputStream() throws IOException
      Throws:
      IOException
    • getBody

      String getBody()
    • setBody

      void setBody(String body)
    • getBodyAsParameters

      Parameters getBodyAsParameters() throws RequestParseException
      Throws:
      RequestParseException
    • getBodyAsParameters

      <T extends Parameters> T getBodyAsParameters(Class<T> requiredType) throws RequestParseException
      Throws:
      RequestParseException
    • getParameters

      Parameters getParameters()
    • getParameters

      <T extends Parameters> T getParameters(Class<T> requiredType)