Class AbstractNettyHttpRequest<B>

java.lang.Object
io.netty.util.DefaultAttributeMap
io.micronaut.http.netty.AbstractNettyHttpRequest<B>
Type Parameters:
B - The body
All Implemented Interfaces:
AttributeHolder, MutableAttributeHolder, HttpMessage<B>, HttpRequest<B>, NettyHttpRequestBuilder, io.netty.util.AttributeMap
Direct Known Subclasses:
NettyHttpRequest

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

    • nettyRequest

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

      protected final ConversionService conversionService
    • httpMethod

      protected final HttpMethod httpMethod
    • unvalidatedUrl

      protected final String unvalidatedUrl
    • httpMethodName

      protected final String httpMethodName
  • Constructor Details

    • AbstractNettyHttpRequest

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

    • 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
    • toFullHttpRequest

      @NonNull public io.netty.handler.codec.http.FullHttpRequest toFullHttpRequest()
      Description copied from interface: NettyHttpRequestBuilder
      Converts this object to a full http request.
      Specified by:
      toFullHttpRequest in interface NettyHttpRequestBuilder
      Returns:
      a full http request
    • toStreamHttpRequest

      @NonNull public @NonNull StreamedHttpRequest toStreamHttpRequest()
      Description copied from interface: NettyHttpRequestBuilder
      Converts this object to a streamed http request.
      Specified by:
      toStreamHttpRequest in interface NettyHttpRequestBuilder
      Returns:
      The streamed request
    • isStream

      public boolean isStream()
      Specified by:
      isStream in interface NettyHttpRequestBuilder
      Returns:
      Is the request a stream.
    • getNettyRequest

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

      public HttpParameters getParameters()
      Specified by:
      getParameters in interface HttpRequest<B>
      Returns:
      The HTTP parameters contained with the URI query string
    • getCharacterEncoding

      public Charset getCharacterEncoding()
      Specified by:
      getCharacterEncoding in interface HttpMessage<B>
      Returns:
      The request character encoding. Defaults to StandardCharsets.UTF_8
    • getMethod

      public HttpMethod getMethod()
      Specified by:
      getMethod in interface HttpRequest<B>
      Returns:
      The request method
    • getUri

      public URI getUri()
      Specified by:
      getUri in interface HttpRequest<B>
      Returns:
      The full request URI
    • getPath

      public String getPath()
      Specified by:
      getPath in interface HttpRequest<B>
      Returns:
      Get the raw, percent-encoded path without any parameters
    • initCharset

      protected abstract Charset initCharset(Charset characterEncoding)
      Parameters:
      characterEncoding - The character encoding
      Returns:
      The Charset
    • getMaxParams

      protected abstract int getMaxParams()
      Returns:
      the maximum number of parameters.
    • isSemicolonIsNormalChar

      protected abstract boolean isSemicolonIsNormalChar()
      Returns:
      true if yes, false otherwise.
    • createDecoder

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

      public String getMethodName()
      Specified by:
      getMethodName in interface HttpRequest<B>
      Returns:
      The name of the method (same as HttpMethod value for standard http methods).