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, uri

    Fields inherited from interface io.micronaut.http.HttpRequest

    SCHEME_HTTP, SCHEME_HTTPS
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addContent(io.netty.buffer.ByteBufHolder httpContent)
     
    protected Object
     
     
    io.micronaut.core.convert.value.MutableConvertibleValues<Object>
     
     
    <T1> Optional<T1>
    getBody(io.micronaut.core.convert.ArgumentConversionContext<T1> conversionContext)
     
    <T1> Optional<T1>
    getBody(Class<T1> type)
     
    io.netty.channel.ChannelHandlerContext
     
    io.micronaut.http.cookie.Cookies
     
    io.micronaut.http.HttpHeaders
     
    io.micronaut.http.HttpVersion
     
    io.micronaut.web.router.RouteMatch<?>
     
    io.netty.handler.codec.http.HttpRequest
     
     
     
     
    protected Charset
    initCharset(Charset characterEncoding)
     
    boolean
     
    boolean
     
    io.micronaut.http.MutableHttpRequest<T>
     
    void
    Release and cleanup resources.
    protected void
     
    io.micronaut.http.PushCapableHttpRequest<T>
    serverPush(io.micronaut.http.HttpRequest<?> request)
     
    void
    setBody(T body)
    Sets the body.
     

    Methods inherited from class io.micronaut.http.netty.AbstractNettyHttpRequest

    accept, createDecoder, getCharacterEncoding, getContentType, getLocale, getMethod, getMethodName, getNettyRequest, getParameters, getPath, getUri, isStream, toFullHttpRequest, toHttpRequest, toStreamHttpRequest

    Methods inherited from class io.netty.util.DefaultAttributeMap

    attr, hasAttr

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micronaut.core.attr.AttributeHolder

    getAttribute

    Methods inherited from interface io.micronaut.http.HttpMessage

    getBody, getCharacterEncoding, getContentLength, getContentType

    Methods inherited from interface io.micronaut.http.HttpRequest

    accept, getCertificate, getLocale, getMethod, getMethodName, getParameters, getPath, getUri, getUserPrincipal, getUserPrincipal, setAttribute

    Methods 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 - The HttpRequest
      ctx - The ChannelHandlerContext
      environment - The Environment
      serverConfiguration - The HttpServerConfiguration
  • Method Details

    • mutate

      public io.micronaut.http.MutableHttpRequest<T> mutate()
      Specified by:
      mutate in interface io.micronaut.http.HttpRequest<T>
    • getAttribute

      @NonNull public Optional<Object> getAttribute(CharSequence name)
      Specified by:
      getAttribute in interface io.micronaut.core.attr.AttributeHolder
    • getHttpVersion

      public io.micronaut.http.HttpVersion getHttpVersion()
      Specified by:
      getHttpVersion in interface io.micronaut.http.HttpRequest<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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:
      getCookies in interface io.micronaut.http.HttpRequest<T>
    • getRemoteAddress

      public InetSocketAddress getRemoteAddress()
      Specified by:
      getRemoteAddress in interface io.micronaut.http.HttpRequest<T>
    • getServerAddress

      public InetSocketAddress getServerAddress()
      Specified by:
      getServerAddress in interface io.micronaut.http.HttpRequest<T>
    • getServerName

      public String getServerName()
      Specified by:
      getServerName in interface io.micronaut.http.HttpRequest<T>
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface io.micronaut.http.HttpRequest<T>
    • getHeaders

      public io.micronaut.http.HttpHeaders getHeaders()
      Specified by:
      getHeaders in interface io.micronaut.http.HttpMessage<T>
    • getAttributes

      public io.micronaut.core.convert.value.MutableConvertibleValues<Object> getAttributes()
      Specified by:
      getAttributes in interface io.micronaut.core.attr.AttributeHolder
      Specified by:
      getAttributes in interface io.micronaut.http.HttpMessage<T>
      Specified by:
      getAttributes in interface io.micronaut.core.attr.MutableAttributeHolder
    • getBody

      public Optional<T> getBody()
      Specified by:
      getBody in interface io.micronaut.http.HttpMessage<T>
    • buildBody

      protected Object buildBody()
      Returns:
      A CompositeByteBuf
    • getBody

      public <T1> Optional<T1> getBody(Class<T1> type)
      Specified by:
      getBody in interface io.micronaut.http.HttpMessage<T>
    • getBody

      public <T1> Optional<T1> getBody(io.micronaut.core.convert.ArgumentConversionContext<T1> conversionContext)
      Specified by:
      getBody in interface io.micronaut.http.HttpMessage<T>
    • release

      @Internal public void release()
      Release and cleanup resources.
    • releaseIfNecessary

      protected void releaseIfNecessary(Object value)
      Parameters:
      value - An object with a value
    • setBody

      @Internal public void setBody(T body)
      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 as ByteBufHolder
    • isServerPushSupported

      public boolean isServerPushSupported()
      Specified by:
      isServerPushSupported in interface io.micronaut.http.PushCapableHttpRequest<T>
    • serverPush

      public io.micronaut.http.PushCapableHttpRequest<T> serverPush(@NonNull io.micronaut.http.HttpRequest<?> request)
      Specified by:
      serverPush in interface io.micronaut.http.PushCapableHttpRequest<T>
    • initCharset

      protected Charset initCharset(Charset characterEncoding)
      Specified by:
      initCharset in class io.micronaut.http.netty.AbstractNettyHttpRequest<T>