Interface RequestAdapter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      boolean containsHeader​(java.lang.String name)
      Returns a boolean indicating whether the named response header has already been set.
      void extractAttributes​(java.util.Map<java.lang.String,​java.lang.Object> targetAttributes)
      Extracts all the attributes and fills in the specified map.
      void extractParameters​(java.util.Map<java.lang.String,​java.lang.Object> targetParameters)
      Extracts all the parameters and fills in the specified map.
      <T> T getAdaptee()
      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> T getAttribute​(java.lang.String name)
      Returns the value of the named attribute as a given type, or null if 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 a Collection containing the names of the attributes available to this request.
      java.lang.String getBody()  
      Parameters getBodyAsParameters()  
      <T extends Parameters>
      T
      getBodyAsParameters​(java.lang.Class<T> requiredType)  
      java.lang.String getEncoding()
      Returns the name of the character encoding used in the body of this request.
      FileParameter getFileParameter​(java.lang.String name)
      Returns a FileParameter object as a given request parameter name, or null if the file parameter does not exist.
      java.util.Set<java.lang.String> getFileParameterNames()
      Returns a Collection of String objects containing the names of the file parameters contained in this request.
      FileParameter[] getFileParameterValues​(java.lang.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.
      java.lang.String getHeader​(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.InputStream getInputStream()  
      java.util.Locale getLocale()
      Returns the preferred Locale.
      long getMaxRequestSize()  
      java.lang.String getParameter​(java.lang.String name)
      Returns the value of a request parameter as a String, or null if the parameter does not exist.
      ParameterMap getParameterMap()
      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 a Collection of String objects containing the names of the parameters contained in this request.
      Parameters getParameters()  
      <T extends Parameters>
      T
      getParameters​(java.lang.Class<T> requiredType)  
      java.lang.String[] getParameterValues​(java.lang.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.
      MethodType getRequestMethod()
      Returns the method used for the request.
      RequestScope getRequestScope()
      Gets the request scope.
      RequestScope getRequestScope​(boolean create)
      Gets the request scope.
      java.util.TimeZone getTimeZone()
      Returns the preferred TimeZone.
      boolean hasAttributes()
      Returns whether the request has attributes.
      boolean hasFileParameters()
      Returns whether the request has file parameters.
      boolean hasHeaders()
      Returns whether it has headers.
      boolean hasParameters()
      Returns whether the request has parameters.
      void putAllAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attributes)
      Copies all of the mappings from the specified attributes.
      void putAllFileParameters​(MultiValueMap<java.lang.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<java.lang.String,​java.lang.String> parameterMap)
      Copies all of the mappings from the specified parameters.
      void removeAttribute​(java.lang.String name)
      Removes an attribute from this request.
      void removeFileParameter​(java.lang.String name)
      Removes the file parameter with the specified name.
      void setAttribute​(java.lang.String name, java.lang.Object value)
      Stores an attribute in this request.
      void setBody​(java.lang.String body)  
      void setEncoding​(java.lang.String encoding)
      Overrides the name of the character encoding used in the body of this request.
      void setFileParameter​(java.lang.String name, FileParameter fileParameter)
      Sets the FileParameter object to the file parameter with the given name.
      void setFileParameter​(java.lang.String name, FileParameter[] fileParameters)
      Sets the value to the file parameter with the given name.
      void setHeader​(java.lang.String name, java.lang.String value)
      Set the given single header value under the given header name.
      void setLocale​(java.util.Locale locale)
      Sets the preferred Locale.
      void setMaxRequestSize​(long maxRequestSize)  
      void setParameter​(java.lang.String name, java.lang.String value)
      Sets the value to the parameter with the given name.
      void setParameter​(java.lang.String name, java.lang.String[] values)
      Sets the value to the parameter with the given name.
      void setTimeZone​(java.util.TimeZone timeZone)
      Sets the preferred TimeZone.
    • 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 - true to create a new request scope for this request if necessary; false to return null
        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 null if 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) Collection of 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) Collection of 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:
        true if the named response header has already been set; false otherwise
      • 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 name
        value - 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 name
        value - 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 be null
      • 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 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(java.lang.String)
      • getParameterValues

        java.lang.String[] getParameterValues​(java.lang.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:
        getParameter(java.lang.String)
      • getParameterNames

        java.util.Collection<java.lang.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​(java.lang.String name,
                          java.lang.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(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 - a String specifying the name of the parameter
        values - an array of String objects 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 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<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 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​(java.lang.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(java.lang.String)
      • getFileParameterValues

        FileParameter[] getFileParameterValues​(java.lang.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:
        getFileParameter(java.lang.String)
      • getFileParameterNames

        java.util.Set<java.lang.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​(java.lang.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(String, FileParameter[])
      • removeFileParameter

        void removeFileParameter​(java.lang.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<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, 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​(java.lang.String name,
                          java.lang.Object value)
        Stores an attribute in this request.
        Parameters:
        name - specifying the name of the attribute
        value - the Object to be stored
      • getAttributeNames

        java.util.Set<java.lang.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​(java.lang.String name)
        Removes an attribute from this request.
        Parameters:
        name - a String specifying 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 MethodType object
      • getEncoding

        java.lang.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​(java.lang.String encoding)
                  throws java.io.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:
        java.io.UnsupportedEncodingException - if the specified encoding is invalid
      • getLocale

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

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

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

        void setTimeZone​(java.util.TimeZone timeZone)
        Sets the preferred TimeZone.
        Parameters:
        timeZone - a given TimeZone
      • 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()
      • getBodyAsParameters

        <T extends Parameters> T getBodyAsParameters​(java.lang.Class<T> requiredType)
      • getParameters

        <T extends Parameters> T getParameters​(java.lang.Class<T> requiredType)