Class BasicHttpRequest

    • Field Detail

      • method

        private final java.lang.String method
      • path

        private java.lang.String path
      • scheme

        private java.lang.String scheme
      • requestUri

        private java.net.URI requestUri
      • absoluteRequestUri

        private boolean absoluteRequestUri
    • Constructor Detail

      • BasicHttpRequest

        public BasicHttpRequest​(java.lang.String method,
                                java.lang.String scheme,
                                URIAuthority authority,
                                java.lang.String path)
        Creates request message with the given method, host and request path.
        Parameters:
        method - request method.
        scheme - request scheme.
        authority - request authority.
        path - request path.
        Since:
        5.1
      • BasicHttpRequest

        public BasicHttpRequest​(java.lang.String method,
                                java.lang.String path)
        Creates request message with the given method and request path.
        Parameters:
        method - request method.
        path - request path.
      • BasicHttpRequest

        public BasicHttpRequest​(java.lang.String method,
                                HttpHost host,
                                java.lang.String path)
        Creates request message with the given method, host and request path.
        Parameters:
        method - request method.
        host - request host.
        path - request path.
        Since:
        5.0
      • BasicHttpRequest

        public BasicHttpRequest​(java.lang.String method,
                                java.net.URI requestUri)
        Creates request message with the given method, request URI.
        Parameters:
        method - request method.
        requestUri - request URI.
        Since:
        5.0
      • BasicHttpRequest

        public BasicHttpRequest​(Method method,
                                java.lang.String path)
        Creates request message with the given method and request path.
        Parameters:
        method - request method.
        path - request path.
        Since:
        5.0
      • BasicHttpRequest

        public BasicHttpRequest​(Method method,
                                HttpHost host,
                                java.lang.String path)
        Creates request message with the given method, host and request path.
        Parameters:
        method - request method.
        host - request host.
        path - request path.
        Since:
        5.0
      • BasicHttpRequest

        public BasicHttpRequest​(Method method,
                                java.net.URI requestUri)
        Creates request message with the given method, request URI.
        Parameters:
        method - request method.
        requestUri - request URI.
        Since:
        5.0
    • Method Detail

      • addHeader

        public void addHeader​(java.lang.String name,
                              java.lang.Object value)
        Description copied from interface: HttpMessage
        Adds a header to this message. The header will be appended to the end of the list.
        Specified by:
        addHeader in interface HttpMessage
        Parameters:
        name - the name of the header.
        value - the value of the header, taken as the value's Object.toString().
      • setHeader

        public void setHeader​(java.lang.String name,
                              java.lang.Object value)
        Description copied from interface: HttpMessage
        Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.
        Specified by:
        setHeader in interface HttpMessage
        Parameters:
        name - the name of the header.
        value - the value of the header, taken as the value's Object.toString().
      • setVersion

        public void setVersion​(ProtocolVersion version)
        Description copied from interface: HttpMessage
        Sets protocol version.

        For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.

        Specified by:
        setVersion in interface HttpMessage
      • getVersion

        public ProtocolVersion getVersion()
        Description copied from interface: HttpMessage
        Returns protocol version or null when not available.

        For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.

        Specified by:
        getVersion in interface HttpMessage
      • getMethod

        public java.lang.String getMethod()
        Description copied from interface: HttpRequest
        Returns method of this request message.
        Specified by:
        getMethod in interface HttpRequest
        Returns:
        the request method.
      • getPath

        public java.lang.String getPath()
        Description copied from interface: HttpRequest
        Returns URI path of this request message or null if not set.
        Specified by:
        getPath in interface HttpRequest
        Returns:
        the request URI or null.
      • setPath

        public void setPath​(java.lang.String path)
        Description copied from interface: HttpRequest
        Sets URI path of this request message.
        Specified by:
        setPath in interface HttpRequest
      • getScheme

        public java.lang.String getScheme()
        Description copied from interface: HttpRequest
        Returns scheme of this request message.
        Specified by:
        getScheme in interface HttpRequest
        Returns:
        the scheme or null.
      • setScheme

        public void setScheme​(java.lang.String scheme)
        Description copied from interface: HttpRequest
        Sets scheme of this request message.
        Specified by:
        setScheme in interface HttpRequest
      • setAbsoluteRequestUri

        public void setAbsoluteRequestUri​(boolean absoluteRequestUri)
        Sets a flag that the getRequestUri() method should return the request URI in an absolute form.

        This flag can used when the request is going to be transmitted via an HTTP/1.1 proxy.

        Since:
        5.1
      • getRequestUri

        public java.lang.String getRequestUri()
        Description copied from interface: HttpRequest
        Returns request URI of this request message. It may be an absolute or relative URI. Applicable to HTTP/1.1 version or earlier.
        Specified by:
        getRequestUri in interface HttpRequest
        Returns:
        the request URI.
      • setUri

        public void setUri​(java.net.URI requestUri)
        Description copied from interface: HttpRequest
        Sets the full request URI of this request message.
        Specified by:
        setUri in interface HttpRequest
        Parameters:
        requestUri - the request URI.
      • assembleRequestUri

        private void assembleRequestUri​(java.lang.StringBuilder buf)
      • getUri

        public java.net.URI getUri()
                            throws java.net.URISyntaxException
        Description copied from interface: HttpRequest
        Returns full request URI of this request message.
        Specified by:
        getUri in interface HttpRequest
        Returns:
        the request URI.
        Throws:
        java.net.URISyntaxException