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:
BasicFullHttpRequest,Http1Request
public class BasicHttpRequest
extends io.netty.handler.codec.http.DefaultHttpRequest
implements BasicRequest, io.netty.util.AttributeMap, Cloneable
-
Constructor Summary
ConstructorsConstructorDescriptionBasicHttpRequest(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 theAttributefor the givenAttributeKey.clone()Construct a full copy of the request.booleanprotected static UUIDgenerateRequestId(io.netty.handler.codec.http.HttpMethod method, String uri, long requestTimestamp, long requestNanos) The request method namelongThe content length of the request body in bytes, as retrieved by the header, or -1 if not known.The request headers.final UUIDReturns the computed request ID of the packet, which is intended to be reasonably unique.final longReturns the nanotime of the first packet of which formed this request object.final longReturns the timestamp of the first packet of which formed this request object.<T> booleanhasAttr(io.netty.util.AttributeKey<T> key) Returns true if and only if the givenAttributeexists in thisAttributeMap.inthashCode()final voidsetAttributeMap(io.netty.util.AttributeMap attributes) Methods inherited from class io.netty.handler.codec.http.DefaultHttpRequest
getMethod, getUri, method, setMethod, setProtocolVersion, setUri, toString, uriMethods inherited from class io.netty.handler.codec.http.DefaultHttpMessage
getProtocolVersion, headers, protocolVersionMethods inherited from class io.netty.handler.codec.http.DefaultHttpObject
decoderResult, getDecoderResult, setDecoderResultMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.linkedin.alpini.base.misc.BasicRequest
getUriMethods inherited from interface io.netty.handler.codec.DecoderResultProvider
decoderResult, setDecoderResultMethods inherited from interface io.netty.handler.codec.http.HttpMessage
getProtocolVersion, headers, protocolVersionMethods 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:
equalsin 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:
getRequestIdin interfaceBasicRequest- Returns:
- an integer.
-
getMethodName
Description copied from interface:BasicRequestThe request method name- Specified by:
getMethodNamein interfaceBasicRequest- Returns:
- method string
-
getRequestTimestamp
public final long getRequestTimestamp()Returns the timestamp of the first packet of which formed this request object.- Specified by:
getRequestTimestampin 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:
getRequestNanosin interfaceBasicRequest- Returns:
- nanotime
- See Also:
-
getRequestContentLength
public long getRequestContentLength()Description copied from interface:BasicRequestThe content length of the request body in bytes, as retrieved by the header, or -1 if not known.- Specified by:
getRequestContentLengthin interfaceBasicRequest- Returns:
- content length
-
getRequestHeaders
Description copied from interface:BasicRequestThe request headers.- Specified by:
getRequestHeadersin interfaceBasicRequest- Returns:
- headers
-
generateRequestId
-
hashCode
public int hashCode()- Overrides:
hashCodein 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 theAttributefor the givenAttributeKey. This method will never return null, but may return anAttributewhich does not have a value set yet.- Specified by:
attrin interfaceio.netty.util.AttributeMap- Parameters:
key-
-
hasAttr
public <T> boolean hasAttr(io.netty.util.AttributeKey<T> key) Returns true if and only if the givenAttributeexists in thisAttributeMap.- Specified by:
hasAttrin interfaceio.netty.util.AttributeMap- Parameters:
key-
-
duplicate
Construct a full copy of the request.- Returns:
- copy of request
-