Package io.micronaut.http.server.netty
Class NettyHttpRequest<T>
java.lang.Object
io.netty.util.DefaultAttributeMap
io.micronaut.http.netty.AbstractNettyHttpRequest<T>
io.micronaut.http.server.netty.NettyHttpRequest<T>
- Type Parameters:
T- The type
- All Implemented Interfaces:
io.micronaut.core.attr.AttributeHolder,io.micronaut.core.attr.MutableAttributeHolder,io.micronaut.http.HttpMessage<T>,io.micronaut.http.HttpRequest<T>,io.micronaut.http.netty.NettyHttpRequestBuilder,io.micronaut.http.PushCapableHttpRequest<T>,io.netty.util.AttributeMap
@Internal
public class NettyHttpRequest<T>
extends io.micronaut.http.netty.AbstractNettyHttpRequest<T>
implements io.micronaut.http.HttpRequest<T>, io.micronaut.http.PushCapableHttpRequest<T>
Delegates to the Netty
HttpRequest instance.- Since:
- 1.0
-
Field Summary
Fields inherited from class io.micronaut.http.netty.AbstractNettyHttpRequest
conversionService, httpMethod, httpMethodName, nettyRequest, uriFields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS -
Constructor Summary
ConstructorsConstructorDescriptionNettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, io.netty.channel.ChannelHandlerContext ctx, io.micronaut.core.convert.ConversionService environment, io.micronaut.http.server.HttpServerConfiguration serverConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(io.netty.buffer.ByteBufHolder httpContent) protected ObjectgetAttribute(CharSequence name) io.micronaut.core.convert.value.MutableConvertibleValues<Object>getBody()<T1> Optional<T1>getBody(io.micronaut.core.convert.ArgumentConversionContext<T1> conversionContext) <T1> Optional<T1>io.netty.channel.ChannelHandlerContextio.micronaut.http.cookie.Cookiesio.micronaut.http.HttpHeadersio.micronaut.http.HttpVersionio.micronaut.web.router.RouteMatch<?>io.netty.handler.codec.http.HttpRequestprotected CharsetinitCharset(Charset characterEncoding) booleanisSecure()booleanio.micronaut.http.MutableHttpRequest<T>mutate()voidrelease()Release and cleanup resources.protected voidreleaseIfNecessary(Object value) io.micronaut.http.PushCapableHttpRequest<T>serverPush(io.micronaut.http.HttpRequest<?> request) voidSets the body.toString()Methods inherited from class io.micronaut.http.netty.AbstractNettyHttpRequest
accept, createDecoder, getCharacterEncoding, getContentType, getLocale, getMethod, getMethodName, getNettyRequest, getParameters, getPath, getUri, isStream, toFullHttpRequest, toHttpRequest, toStreamHttpRequestMethods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttrMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttributeMethods inherited from interface io.micronaut.http.HttpMessage
getBody, getCharacterEncoding, getContentLength, getContentTypeMethods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getLocale, getMethod, getMethodName, getParameters, getPath, getUri, getUserPrincipal, getUserPrincipal, setAttributeMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Constructor Details
-
NettyHttpRequest
public NettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, io.netty.channel.ChannelHandlerContext ctx, io.micronaut.core.convert.ConversionService environment, io.micronaut.http.server.HttpServerConfiguration serverConfiguration) - Parameters:
nettyRequest- TheHttpRequestctx- TheChannelHandlerContextenvironment- The EnvironmentserverConfiguration- TheHttpServerConfiguration
-
-
Method Details
-
mutate
- Specified by:
mutatein interfaceio.micronaut.http.HttpRequest<T>
-
getAttribute
- Specified by:
getAttributein interfaceio.micronaut.core.attr.AttributeHolder
-
getHttpVersion
public io.micronaut.http.HttpVersion getHttpVersion()- Specified by:
getHttpVersionin interfaceio.micronaut.http.HttpRequest<T>
-
toString
-
getNativeRequest
public io.netty.handler.codec.http.HttpRequest getNativeRequest()- Returns:
- Obtain a reference to the native Netty HTTP request
-
getChannelHandlerContext
public io.netty.channel.ChannelHandlerContext getChannelHandlerContext()- Returns:
- The
ChannelHandlerContext
-
getCookies
public io.micronaut.http.cookie.Cookies getCookies()- Specified by:
getCookiesin interfaceio.micronaut.http.HttpRequest<T>
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceio.micronaut.http.HttpRequest<T>
-
getServerAddress
- Specified by:
getServerAddressin interfaceio.micronaut.http.HttpRequest<T>
-
getServerName
- Specified by:
getServerNamein interfaceio.micronaut.http.HttpRequest<T>
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfaceio.micronaut.http.HttpRequest<T>
-
getHeaders
public io.micronaut.http.HttpHeaders getHeaders()- Specified by:
getHeadersin interfaceio.micronaut.http.HttpMessage<T>
-
getAttributes
- Specified by:
getAttributesin interfaceio.micronaut.core.attr.AttributeHolder- Specified by:
getAttributesin interfaceio.micronaut.http.HttpMessage<T>- Specified by:
getAttributesin interfaceio.micronaut.core.attr.MutableAttributeHolder
-
getBody
- Specified by:
getBodyin interfaceio.micronaut.http.HttpMessage<T>
-
buildBody
- Returns:
- A
CompositeByteBuf
-
getBody
- Specified by:
getBodyin interfaceio.micronaut.http.HttpMessage<T>
-
getBody
public <T1> Optional<T1> getBody(io.micronaut.core.convert.ArgumentConversionContext<T1> conversionContext) - Specified by:
getBodyin interfaceio.micronaut.http.HttpMessage<T>
-
release
@Internal public void release()Release and cleanup resources. -
releaseIfNecessary
- Parameters:
value- An object with a value
-
setBody
Sets the body.- Parameters:
body- The body to set
-
getMatchedRoute
@Internal public io.micronaut.web.router.RouteMatch<?> getMatchedRoute()- Returns:
- Obtains the matched route
-
addContent
@Internal public void addContent(io.netty.buffer.ByteBufHolder httpContent) - Parameters:
httpContent- The HttpContent asByteBufHolder
-
isServerPushSupported
public boolean isServerPushSupported()- Specified by:
isServerPushSupportedin interfaceio.micronaut.http.PushCapableHttpRequest<T>
-
serverPush
public io.micronaut.http.PushCapableHttpRequest<T> serverPush(@NonNull io.micronaut.http.HttpRequest<?> request) - Specified by:
serverPushin interfaceio.micronaut.http.PushCapableHttpRequest<T>
-
initCharset
- Specified by:
initCharsetin classio.micronaut.http.netty.AbstractNettyHttpRequest<T>
-