Class BasicHttpRequest

java.lang.Object
io.netty.handler.codec.http.DefaultHttpObject
io.netty.handler.codec.http.DefaultHttpMessage
io.netty.handler.codec.http.DefaultHttpRequest
com.linkedin.alpini.netty4.misc.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, Cloneable
Direct Known Subclasses:
BasicFullHttpMultiPartRequest, BasicFullHttpRequest, Http1Request

public class BasicHttpRequest extends io.netty.handler.codec.http.DefaultHttpRequest implements BasicRequest, io.netty.util.AttributeMap, 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, String uri)
    Creates a new instance.
    BasicHttpRequest(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, 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, 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, String uri, io.netty.handler.codec.http.HttpHeaders headers, UUID requestId, long requestTimestamp, long requestNanos)
    Creates a new instance.
  • Method Summary

    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.
     
    Construct a full copy of the request.
    boolean
     
    protected static UUID
    generateRequestId(io.netty.handler.codec.http.HttpMethod method, String uri, long requestTimestamp, long requestNanos)
     
    The request method name
    long
    The content length of the request body in bytes, as retrieved by the header, or -1 if not known.
    The request headers.
    final UUID
    Returns the computed request ID of the packet, which is intended to be reasonably unique.
    final long
    Returns the nanotime of the first packet of which formed this request object.
    final long
    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
     
    final 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 com.linkedin.alpini.base.misc.BasicRequest

    getUri

    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 Details

    • BasicHttpRequest

      public BasicHttpRequest(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpMethod method, 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, 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, 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, String uri, io.netty.handler.codec.http.HttpHeaders headers, 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 Details

    • equals

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

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

      public final 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 String getMethodName()
      Description copied from interface: BasicRequest
      The request method name
      Specified by:
      getMethodName in interface BasicRequest
      Returns:
      method string
    • getRequestTimestamp

      public final long getRequestTimestamp()
      Returns the timestamp of the first packet of which formed this request object.
      Specified by:
      getRequestTimestamp in interface BasicRequest
      Returns:
      timestamp
      See Also:
    • 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:
    • 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
    • getRequestHeaders

      public Headers getRequestHeaders()
      Description copied from interface: BasicRequest
      The request headers.
      Specified by:
      getRequestHeaders in interface BasicRequest
      Returns:
      headers
    • generateRequestId

      protected static UUID generateRequestId(io.netty.handler.codec.http.HttpMethod method, 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