T
- The type@Internal public class NettyHttpRequest<T> extends AbstractNettyHttpRequest<T> implements HttpRequest<T>
HttpRequest
instance.conversionService, HTTP2_SCHEME, httpMethod, httpMethodName, nettyRequest, STREAM_ID, uri
SCHEME_HTTP, SCHEME_HTTPS
Constructor and Description |
---|
NettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest,
io.netty.channel.ChannelHandlerContext ctx,
ConversionService environment,
HttpServerConfiguration serverConfiguration) |
Modifier and Type | Method and Description |
---|---|
void |
addContent(io.netty.buffer.ByteBufHolder httpContent) |
protected java.lang.Object |
buildBody() |
java.util.Optional<java.lang.Object> |
getAttribute(java.lang.CharSequence name)
Obtain the value of an attribute on the HTTP method.
|
MutableConvertibleValues<java.lang.Object> |
getAttributes()
A
MutableConvertibleValues of the attributes for this HTTP message. |
java.util.Optional<T> |
getBody() |
<T1> java.util.Optional<T1> |
getBody(Argument<T1> type)
Return the body as the given type.
|
<T1> java.util.Optional<T1> |
getBody(java.lang.Class<T1> type)
Return the body as the given type.
|
io.netty.channel.ChannelHandlerContext |
getChannelHandlerContext() |
Cookies |
getCookies() |
HttpHeaders |
getHeaders() |
RouteMatch<?> |
getMatchedRoute() |
io.netty.handler.codec.http.HttpRequest |
getNativeRequest() |
java.net.InetSocketAddress |
getRemoteAddress() |
java.net.InetSocketAddress |
getServerAddress() |
java.lang.String |
getServerName() |
protected java.nio.charset.Charset |
initCharset(java.nio.charset.Charset characterEncoding) |
boolean |
isSecure() |
MutableHttpRequest<T> |
mutate()
Returns a new request object that allows mutation.
|
void |
release()
Release and cleanup resources.
|
protected void |
releaseIfNecessary(java.lang.Object value) |
void |
setBody(T body)
Sets the body.
|
java.lang.String |
toString() |
accept, createDecoder, getCharacterEncoding, getContentType, getHttpVersion, getLocale, getMethod, getMethodName, getNettyRequest, getParameters, getPath, getUri, isStream, toFullHttpRequest, toHttpRequest, toStreamHttpRequest
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept, create, create, DELETE, DELETE, DELETE, GET, GET, getCertificate, getHttpVersion, getLocale, getMethod, getMethodName, getParameters, getPath, getUri, getUserPrincipal, getUserPrincipal, HEAD, HEAD, OPTIONS, OPTIONS, PATCH, PATCH, POST, POST, PUT, PUT, setAttribute
getCharacterEncoding, getContentLength, getContentType
removeAttribute
getAttribute
toHttpRequest
public NettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, io.netty.channel.ChannelHandlerContext ctx, ConversionService environment, HttpServerConfiguration serverConfiguration)
nettyRequest
- The HttpRequest
ctx
- The ChannelHandlerContext
environment
- The EnvironmentserverConfiguration
- The HttpServerConfiguration
public MutableHttpRequest<T> mutate()
HttpRequest
mutate
in interface HttpRequest<T>
@NonNull public java.util.Optional<java.lang.Object> getAttribute(java.lang.CharSequence name)
AttributeHolder
getAttribute
in interface AttributeHolder
name
- The name of the attributeOptional
valuepublic java.lang.String toString()
toString
in class java.lang.Object
public io.netty.handler.codec.http.HttpRequest getNativeRequest()
public io.netty.channel.ChannelHandlerContext getChannelHandlerContext()
ChannelHandlerContext
public Cookies getCookies()
getCookies
in interface HttpRequest<T>
Cookies
instancepublic java.net.InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface HttpRequest<T>
public java.net.InetSocketAddress getServerAddress()
getServerAddress
in interface HttpRequest<T>
public java.lang.String getServerName()
getServerName
in interface HttpRequest<T>
public boolean isSecure()
isSecure
in interface HttpRequest<T>
public HttpHeaders getHeaders()
getHeaders
in interface HttpMessage<T>
HttpHeaders
objectpublic MutableConvertibleValues<java.lang.Object> getAttributes()
HttpMessage
A MutableConvertibleValues
of the attributes for this HTTP message.
Attributes are designed for internal data sharing and hence are isolated from headers and parameters which are client supplied
getAttributes
in interface AttributeHolder
getAttributes
in interface MutableAttributeHolder
getAttributes
in interface HttpMessage<T>
public java.util.Optional<T> getBody()
getBody
in interface HttpMessage<T>
protected java.lang.Object buildBody()
CompositeByteBuf
public <T1> java.util.Optional<T1> getBody(java.lang.Class<T1> type)
HttpMessage
getBody
in interface HttpMessage<T>
T1
- The generic typetype
- The type of the bodyOptional
of the type or Optional.empty()
if the body cannot be returned as the given typepublic <T1> java.util.Optional<T1> getBody(Argument<T1> type)
HttpMessage
getBody
in interface HttpMessage<T>
T1
- The generic typetype
- The type of the bodyOptional
of the type or Optional.empty()
if the body cannot be returned as the given type@Internal public void release()
protected void releaseIfNecessary(java.lang.Object value)
value
- An object with a value@Internal public RouteMatch<?> getMatchedRoute()
@Internal public void addContent(io.netty.buffer.ByteBufHolder httpContent)
httpContent
- The HttpContent as ByteBufHolder
protected java.nio.charset.Charset initCharset(java.nio.charset.Charset characterEncoding)
initCharset
in class AbstractNettyHttpRequest<T>
characterEncoding
- The charactger encoding