Package com.linkedin.alpini.netty4.misc
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
,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 theAttribute
for the givenAttributeKey
.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 namelong
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 givenAttribute
exists in thisAttributeMap
.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 com.linkedin.alpini.base.misc.BasicRequest
getUri
-
Methods inherited from interface io.netty.handler.codec.DecoderResultProvider
decoderResult, setDecoderResult
-
-
-
-
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 requestmethod
- the HTTP method of the requesturi
- 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 requestmethod
- the HTTP method of the requesturi
- 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 requestmethod
- the HTTP method of the requesturi
- the URI or path of the requestvalidateHeaders
- validate the header names and values when adding them to theHttpHeaders
-
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 requestmethod
- the HTTP method of the requesturi
- the URI or path of the requestheaders
- 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 classio.netty.handler.codec.http.DefaultHttpRequest
-
clone
public BasicHttpRequest clone()
- Overrides:
clone
in classjava.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 interfaceBasicRequest
- Returns:
- an integer.
-
getMethodName
public java.lang.String getMethodName()
Description copied from interface:BasicRequest
The request method name- Specified by:
getMethodName
in interfaceBasicRequest
- 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 interfaceBasicRequest
- Returns:
- timestamp
- See Also:
Time.currentTimeMillis()
-
getRequestNanos
public final long getRequestNanos()
Returns the nanotime of the first packet of which formed this request object.- Specified by:
getRequestNanos
in interfaceBasicRequest
- 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 interfaceBasicRequest
- Returns:
- content length
-
getRequestHeaders
public Headers getRequestHeaders()
Description copied from interface:BasicRequest
The request headers.- Specified by:
getRequestHeaders
in interfaceBasicRequest
- Returns:
- headers
-
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 classio.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 theAttribute
for the givenAttributeKey
. This method will never return null, but may return anAttribute
which does not have a value set yet.- Specified by:
attr
in interfaceio.netty.util.AttributeMap
- Parameters:
key
-
-
hasAttr
public <T> boolean hasAttr(io.netty.util.AttributeKey<T> key)
Returns true if and only if the givenAttribute
exists in thisAttributeMap
.- Specified by:
hasAttr
in interfaceio.netty.util.AttributeMap
- Parameters:
key
-
-
duplicate
public BasicHttpRequest duplicate()
Construct a full copy of the request.- Returns:
- copy of request
-
-