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
,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
ConstructorDescriptionBasicHttpRequest
(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 TypeMethodDescription<T> io.netty.util.Attribute<T>
attr
(io.netty.util.AttributeKey<T> key) Get theAttribute
for the givenAttributeKey
.clone()
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 namelong
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 givenAttribute
exists in thisAttributeMap
.int
hashCode()
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 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, 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, 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, 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 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 Details
-
equals
- Overrides:
equals
in classio.netty.handler.codec.http.DefaultHttpRequest
-
clone
-
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
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:
-
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:
-
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
Description copied from interface:BasicRequest
The request headers.- Specified by:
getRequestHeaders
in interfaceBasicRequest
- Returns:
- headers
-
generateRequestId
-
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
Construct a full copy of the request.- Returns:
- copy of request
-