Class AbstractNettyHttpRequest<B>

  • Type Parameters:
    B - The body
    All Implemented Interfaces:
    io.micronaut.core.attr.AttributeHolder, io.micronaut.core.attr.MutableAttributeHolder, io.micronaut.http.HttpMessage<B>, io.micronaut.http.HttpRequest<B>, NettyHttpRequestBuilder, io.netty.util.AttributeMap

    @Internal
    public abstract class AbstractNettyHttpRequest<B>
    extends io.netty.util.DefaultAttributeMap
    implements io.micronaut.http.HttpRequest<B>, NettyHttpRequestBuilder
    Abstract implementation of HttpRequest for Netty.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected io.micronaut.core.convert.ConversionService<?> conversionService  
      static io.netty.util.AsciiString HTTP2_SCHEME  
      protected io.micronaut.http.HttpMethod httpMethod  
      protected java.lang.String httpMethodName  
      protected io.netty.handler.codec.http.HttpRequest nettyRequest  
      static io.netty.util.AsciiString STREAM_ID  
      protected java.net.URI uri  
      • Fields inherited from interface io.micronaut.http.HttpRequest

        SCHEME_HTTP, SCHEME_HTTPS
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractNettyHttpRequest​(io.netty.handler.codec.http.HttpRequest nettyRequest, io.micronaut.core.convert.ConversionService conversionService)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<io.micronaut.http.MediaType> accept()  
      protected io.netty.handler.codec.http.QueryStringDecoder createDecoder​(java.net.URI uri)  
      java.nio.charset.Charset getCharacterEncoding()  
      java.util.Optional<io.micronaut.http.MediaType> getContentType()  
      io.micronaut.http.HttpVersion getHttpVersion()  
      java.util.Optional<java.util.Locale> getLocale()  
      io.micronaut.http.HttpMethod getMethod()  
      java.lang.String getMethodName()  
      io.netty.handler.codec.http.HttpRequest getNettyRequest()  
      io.micronaut.http.HttpParameters getParameters()  
      java.lang.String getPath()  
      java.net.URI getUri()  
      protected abstract java.nio.charset.Charset initCharset​(java.nio.charset.Charset characterEncoding)  
      boolean isStream()  
      io.netty.handler.codec.http.FullHttpRequest toFullHttpRequest()
      Converts this object to a full http request.
      io.netty.handler.codec.http.HttpRequest toHttpRequest()
      Converts this object to the most appropriate http request type.
      StreamedHttpRequest toStreamHttpRequest()
      Converts this object to a streamed http request.
      • Methods inherited from class io.netty.util.DefaultAttributeMap

        attr, hasAttr
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.micronaut.core.attr.AttributeHolder

        getAttribute, getAttribute
      • Methods inherited from interface io.micronaut.http.HttpMessage

        getAttributes, getBody, getBody, getBody, getContentLength, getHeaders
      • Methods inherited from interface io.micronaut.http.HttpRequest

        getCertificate, getCookies, getRemoteAddress, getServerAddress, getServerName, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute
      • Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder

        removeAttribute
    • Field Detail

      • STREAM_ID

        public static final io.netty.util.AsciiString STREAM_ID
      • HTTP2_SCHEME

        public static final io.netty.util.AsciiString HTTP2_SCHEME
      • nettyRequest

        protected final io.netty.handler.codec.http.HttpRequest nettyRequest
      • conversionService

        protected final io.micronaut.core.convert.ConversionService<?> conversionService
      • httpMethod

        protected final io.micronaut.http.HttpMethod httpMethod
      • uri

        protected final java.net.URI uri
      • httpMethodName

        protected final java.lang.String httpMethodName
    • Constructor Detail

      • AbstractNettyHttpRequest

        public AbstractNettyHttpRequest​(io.netty.handler.codec.http.HttpRequest nettyRequest,
                                        io.micronaut.core.convert.ConversionService conversionService)
        Parameters:
        nettyRequest - The Http netty request
        conversionService - The conversion service
    • Method Detail

      • toHttpRequest

        @NonNull
        public io.netty.handler.codec.http.HttpRequest toHttpRequest()
        Description copied from interface: NettyHttpRequestBuilder
        Converts this object to the most appropriate http request type.
        Specified by:
        toHttpRequest in interface NettyHttpRequestBuilder
        Returns:
        The http request
      • getHttpVersion

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

        public io.netty.handler.codec.http.HttpRequest getNettyRequest()
        Returns:
        The native netty request
      • getParameters

        public io.micronaut.http.HttpParameters getParameters()
        Specified by:
        getParameters in interface io.micronaut.http.HttpRequest<B>
      • accept

        public java.util.Collection<io.micronaut.http.MediaType> accept()
        Specified by:
        accept in interface io.micronaut.http.HttpRequest<B>
      • getContentType

        public java.util.Optional<io.micronaut.http.MediaType> getContentType()
        Specified by:
        getContentType in interface io.micronaut.http.HttpMessage<B>
      • getCharacterEncoding

        public java.nio.charset.Charset getCharacterEncoding()
        Specified by:
        getCharacterEncoding in interface io.micronaut.http.HttpMessage<B>
      • getLocale

        public java.util.Optional<java.util.Locale> getLocale()
        Specified by:
        getLocale in interface io.micronaut.http.HttpMessage<B>
        Specified by:
        getLocale in interface io.micronaut.http.HttpRequest<B>
      • getMethod

        public io.micronaut.http.HttpMethod getMethod()
        Specified by:
        getMethod in interface io.micronaut.http.HttpRequest<B>
      • getUri

        public java.net.URI getUri()
        Specified by:
        getUri in interface io.micronaut.http.HttpRequest<B>
      • getPath

        public java.lang.String getPath()
        Specified by:
        getPath in interface io.micronaut.http.HttpRequest<B>
      • initCharset

        protected abstract java.nio.charset.Charset initCharset​(java.nio.charset.Charset characterEncoding)
        Parameters:
        characterEncoding - The charactger encoding
        Returns:
        The Charset
      • createDecoder

        protected final io.netty.handler.codec.http.QueryStringDecoder createDecoder​(java.net.URI uri)
        Parameters:
        uri - The URI
        Returns:
        The query string decoder
      • getMethodName

        public java.lang.String getMethodName()
        Specified by:
        getMethodName in interface io.micronaut.http.HttpRequest<B>