Class Request

    • Constructor Detail

      • Request

        public Request()
        Creates a new request message.
      • Request

        public Request​(Request request)
                throws IOException
        Creates a defensive copy of the given request message.
        Parameters:
        request - request to be copied
        Throws:
        IOException - when entity cannot be cloned
    • Method Detail

      • getCookies

        public RequestCookies getCookies()
        Returns the incoming request cookies.
        Returns:
        The incoming request cookies.
      • getQueryParams

        public Form getQueryParams()
        Returns a copy of the query parameters decoded as a form. Modifications to the returned form are not reflected in this request.
        Returns:
        The query parameters as a form.
      • getMethod

        public String getMethod()
        Returns the method to be performed on the resource.
        Returns:
        The method to be performed on the resource.
      • getUri

        public MutableUri getUri()
        Returns the fully-qualified URI of the resource being accessed.
        Returns:
        The fully-qualified URI of the resource being accessed.
      • setEntity

        public Request setEntity​(Object o)
        Description copied from interface: Message
        Sets the content of the entity to the provided value. Calling this method will close any existing streams associated with the entity. May also set the Content-Length header, overwriting any existing header.

        This method is intended mostly as a convenience method within scripts. The parameter will be handled depending on its type as follows:

        Note: This method does not attempt to encode the entity based-on any codings specified in the Content-Encoding header.

        Parameters:
        o - The object whose value should be stored in the entity.
        Returns:
        This message.
      • setMethod

        public Request setMethod​(String method)
        Sets the method to be performed on the resource.
        Parameters:
        method - The method to be performed on the resource.
        Returns:
        This request.
      • setUri

        public Request setUri​(String uri)
                       throws URISyntaxException
        Sets the fully-qualified string URI of the resource being accessed.
        Parameters:
        uri - The fully-qualified string URI of the resource being accessed.
        Returns:
        This request.
        Throws:
        URISyntaxException - if the given URI string is not well-formed.
      • setUri

        public Request setUri​(URI uri)
        Sets the fully-qualified URI of the resource being accessed.
        Parameters:
        uri - The fully-qualified URI of the resource being accessed.
        Returns:
        This request.
      • setVersion

        public Request setVersion​(String version)
        Description copied from interface: Message
        Sets the protocol version. Default: HTTP/1.1.
        Parameters:
        version - The protocol version.
        Returns:
        This message.
      • lazyCopy

        public LazySupplier<Request,​IOException> lazyCopy()
        Returns a Supplier that will lazily copy the request object the first time it is accessed. The same copied request object will be returned on subsequent calls to Supplier.get(). The returned supplier is thread-safe.
        Returns:
        a supplier for the copied request object.