Class BasicHttpRequest

  • All Implemented Interfaces:
    BasicRequest, io.netty.handler.codec.DecoderResultProvider, io.netty.handler.codec.http.HttpMessage, io.netty.handler.codec.http.HttpObject, io.netty.handler.codec.http.HttpRequest, io.netty.util.AttributeMap, java.lang.Cloneable
    Direct Known Subclasses:
    BasicFullHttpMultiPartRequest, BasicFullHttpRequest, Http1Request

    public class BasicHttpRequest
    extends io.netty.handler.codec.http.DefaultHttpRequest
    implements BasicRequest, io.netty.util.AttributeMap, java.lang.Cloneable
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicHttpRequest​(io.netty.handler.codec.http.HttpRequest request)  
      BasicHttpRequest​(io.netty.handler.codec.http.HttpRequest request, io.netty.handler.codec.http.HttpHeaders headers)  
      BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, java.lang.String uri)
      Creates a new instance.
      BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, java.lang.String uri, boolean validateHeaders, long requestTimestamp, long requestNanos)
      Creates a new instance.
      BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, java.lang.String uri, long requestTimestamp, long requestNanos)
      Creates a new instance.
      BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, java.lang.String uri, io.netty.handler.codec.http.HttpHeaders headers, java.util.UUID requestId, long requestTimestamp, long requestNanos)
      Creates a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> io.netty.util.Attribute<T> attr​(io.netty.util.AttributeKey<T> key)
      Get the Attribute for the given AttributeKey.
      BasicHttpRequest clone()  
      BasicHttpRequest duplicate()
      Construct a full copy of the request.
      boolean equals​(java.lang.Object o)  
      protected static java.util.UUID generateRequestId​(io.netty.handler.codec.http.HttpMethod method, java.lang.String uri, long requestTimestamp, long requestNanos)  
      java.lang.String getMethodName()
      The request method name
      long getRequestContentLength()
      The content length of the request body in bytes, as retrieved by the header, or -1 if not known.
      Headers getRequestHeaders()
      The request headers.
      java.util.UUID getRequestId()
      Returns the computed request ID of the packet, which is intended to be reasonably unique.
      long getRequestNanos()
      Returns the nanotime of the first packet of which formed this request object.
      long getRequestTimestamp()
      Returns the timestamp of the first packet of which formed this request object.
      <T> boolean hasAttr​(io.netty.util.AttributeKey<T> key)
      Returns true if and only if the given Attribute exists in this AttributeMap.
      int hashCode()  
      void setAttributeMap​(io.netty.util.AttributeMap attributes)  
      • Methods inherited from class io.netty.handler.codec.http.DefaultHttpRequest

        getMethod, getUri, method, setMethod, setProtocolVersion, setUri, toString, uri
      • Methods inherited from class io.netty.handler.codec.http.DefaultHttpMessage

        getProtocolVersion, headers, protocolVersion
      • Methods inherited from class io.netty.handler.codec.http.DefaultHttpObject

        decoderResult, getDecoderResult, setDecoderResult
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface io.netty.handler.codec.DecoderResultProvider

        decoderResult, setDecoderResult
      • Methods inherited from interface io.netty.handler.codec.http.HttpMessage

        getProtocolVersion, headers, protocolVersion
      • Methods inherited from interface io.netty.handler.codec.http.HttpObject

        getDecoderResult
    • Constructor Detail

      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion,
                                io.netty.handler.codec.http.HttpMethod method,
                                java.lang.String uri)
        Creates a new instance.
        Parameters:
        httpVersion - the HTTP version of the request
        method - the HTTP method of the request
        uri - the URI or path of the request
      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion,
                                io.netty.handler.codec.http.HttpMethod method,
                                java.lang.String uri,
                                long requestTimestamp,
                                long requestNanos)
        Creates a new instance.
        Parameters:
        httpVersion - the HTTP version of the request
        method - the HTTP method of the request
        uri - the URI or path of the request
      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion,
                                io.netty.handler.codec.http.HttpMethod method,
                                java.lang.String uri,
                                boolean validateHeaders,
                                long requestTimestamp,
                                long requestNanos)
        Creates a new instance.
        Parameters:
        httpVersion - the HTTP version of the request
        method - the HTTP method of the request
        uri - the URI or path of the request
        validateHeaders - validate the header names and values when adding them to the HttpHeaders
      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpVersion httpVersion,
                                io.netty.handler.codec.http.HttpMethod method,
                                java.lang.String uri,
                                io.netty.handler.codec.http.HttpHeaders headers,
                                java.util.UUID requestId,
                                long requestTimestamp,
                                long requestNanos)
        Creates a new instance.
        Parameters:
        httpVersion - the HTTP version of the request
        method - the HTTP method of the request
        uri - the URI or path of the request
        headers - the Headers for this Request
      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpRequest request)
      • BasicHttpRequest

        public BasicHttpRequest​(io.netty.handler.codec.http.HttpRequest request,
                                io.netty.handler.codec.http.HttpHeaders headers)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class io.netty.handler.codec.http.DefaultHttpRequest
      • clone

        public BasicHttpRequest clone()
        Overrides:
        clone in class java.lang.Object
      • getRequestId

        public final java.util.UUID getRequestId()
        Returns the computed request ID of the packet, which is intended to be reasonably unique.
        Specified by:
        getRequestId in interface BasicRequest
        Returns:
        an integer.
      • getMethodName

        public java.lang.String getMethodName()
        Description copied from interface: BasicRequest
        The request method name
        Specified by:
        getMethodName in interface BasicRequest
        Returns:
        method string
      • getRequestNanos

        public final long getRequestNanos()
        Returns the nanotime of the first packet of which formed this request object.
        Specified by:
        getRequestNanos in interface BasicRequest
        Returns:
        nanotime
        See Also:
        Time.nanoTime()
      • getRequestContentLength

        public long getRequestContentLength()
        Description copied from interface: BasicRequest
        The content length of the request body in bytes, as retrieved by the header, or -1 if not known.
        Specified by:
        getRequestContentLength in interface BasicRequest
        Returns:
        content length
      • generateRequestId

        protected static java.util.UUID generateRequestId​(io.netty.handler.codec.http.HttpMethod method,
                                                          java.lang.String uri,
                                                          long requestTimestamp,
                                                          long requestNanos)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class io.netty.handler.codec.http.DefaultHttpRequest
      • setAttributeMap

        public final void setAttributeMap​(io.netty.util.AttributeMap attributes)
      • attr

        public <T> io.netty.util.Attribute<T> attr​(io.netty.util.AttributeKey<T> key)
        Get the Attribute for the given AttributeKey. This method will never return null, but may return an Attribute which does not have a value set yet.
        Specified by:
        attr in interface io.netty.util.AttributeMap
        Parameters:
        key -
      • hasAttr

        public <T> boolean hasAttr​(io.netty.util.AttributeKey<T> key)
        Returns true if and only if the given Attribute exists in this AttributeMap.
        Specified by:
        hasAttr in interface io.netty.util.AttributeMap
        Parameters:
        key -
      • duplicate

        public BasicHttpRequest duplicate()
        Construct a full copy of the request.
        Returns:
        copy of request