Class ActionRequestWrapper

  • All Implemented Interfaces:
    ActionRequest, ClientDataRequest, PortletRequest

    public class ActionRequestWrapper
    extends PortletRequestWrapper
    implements ActionRequest
    The ActionRequestWrapper provides a convenient implementation of the ActionRequest interface that can be subclassed by developers wishing to adapt the request. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.
    Since:
    2.0
    See Also:
    ActionRequest
    • Constructor Detail

      • ActionRequestWrapper

        public ActionRequestWrapper​(ActionRequest request)
        Creates an ActionRequest adaptor wrapping the given request object.
        Parameters:
        request - the action request to wrap
        Throws:
        IllegalArgumentException - if the request is null
    • Method Detail

      • getCharacterEncoding

        public String getCharacterEncoding()
        The default behavior of this method is to call getCharacterEncoding() on the wrapped request object.
        Specified by:
        getCharacterEncoding in interface ClientDataRequest
        Returns:
        a String containing the name of the character encoding, or null if the request does not specify a character encoding.
      • getContentLength

        public int getContentLength()
        The default behavior of this method is to call getContentLength() on the wrapped request object.
        Specified by:
        getContentLength in interface ClientDataRequest
        Returns:
        an integer containing the length of the request body or -1 if the length is not known
      • getContentType

        public String getContentType()
        The default behavior of this method is to call getContentType() on the wrapped request object.
        Specified by:
        getContentType in interface ClientDataRequest
        Returns:
        a String containing the name of the MIME type of the request, or null if the type is not known.
      • getPortletInputStream

        public InputStream getPortletInputStream()
                                          throws IOException
        The default behavior of this method is to call getPortletInputStream() on the wrapped request object.
        Specified by:
        getPortletInputStream in interface ClientDataRequest
        Returns:
        an input stream containing the body of the request
        Throws:
        IOException - if an input or output exception occurred
      • setRequest

        public void setRequest​(ActionRequest request)
        Sets the request object being wrapped.
        Parameters:
        request - the request to set
        Throws:
        IllegalArgumentException - if the request is null.
      • getMethod

        public String getMethod()
        The default behavior of this method is to call getMethod() on the wrapped request object.
        Specified by:
        getMethod in interface ClientDataRequest
        Returns:
        a String specifying the name of the HTTP method with which this request was made