Package io.micronaut.http.netty
Class AbstractNettyHttpRequest<B>
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.micronaut.http.netty.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 ofHttpRequestfor Netty.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected io.micronaut.core.convert.ConversionService<?>conversionServicestatic io.netty.util.AsciiStringHTTP2_SCHEMEprotected io.micronaut.http.HttpMethodhttpMethodprotected java.lang.StringhttpMethodNameprotected io.netty.handler.codec.http.HttpRequestnettyRequeststatic io.netty.util.AsciiStringSTREAM_IDprotected java.net.URIuri
-
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.QueryStringDecodercreateDecoder(java.net.URI uri)java.nio.charset.CharsetgetCharacterEncoding()java.util.Optional<io.micronaut.http.MediaType>getContentType()io.micronaut.http.HttpVersiongetHttpVersion()java.util.Optional<java.util.Locale>getLocale()io.micronaut.http.HttpMethodgetMethod()java.lang.StringgetMethodName()io.netty.handler.codec.http.HttpRequestgetNettyRequest()io.micronaut.http.HttpParametersgetParameters()java.lang.StringgetPath()java.net.URIgetUri()protected abstract java.nio.charset.CharsetinitCharset(java.nio.charset.Charset characterEncoding)booleanisStream()io.netty.handler.codec.http.FullHttpRequesttoFullHttpRequest()Converts this object to a full http request.io.netty.handler.codec.http.HttpRequesttoHttpRequest()Converts this object to the most appropriate http request type.StreamedHttpRequesttoStreamHttpRequest()Converts this object to a streamed http request.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getContentLength, getHeaders
-
-
-
-
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
-
-
Method Detail
-
toHttpRequest
@NonNull public io.netty.handler.codec.http.HttpRequest toHttpRequest()
Description copied from interface:NettyHttpRequestBuilderConverts this object to the most appropriate http request type.- Specified by:
toHttpRequestin interfaceNettyHttpRequestBuilder- Returns:
- The http request
-
toFullHttpRequest
@NonNull public io.netty.handler.codec.http.FullHttpRequest toFullHttpRequest()
Description copied from interface:NettyHttpRequestBuilderConverts this object to a full http request.- Specified by:
toFullHttpRequestin interfaceNettyHttpRequestBuilder- Returns:
- a full http request
-
toStreamHttpRequest
@NonNull public StreamedHttpRequest toStreamHttpRequest()
Description copied from interface:NettyHttpRequestBuilderConverts this object to a streamed http request.- Specified by:
toStreamHttpRequestin interfaceNettyHttpRequestBuilder- Returns:
- The streamed request
-
isStream
public boolean isStream()
- Specified by:
isStreamin interfaceNettyHttpRequestBuilder- Returns:
- Is the request a stream.
-
getHttpVersion
public io.micronaut.http.HttpVersion getHttpVersion()
- Specified by:
getHttpVersionin interfaceio.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:
getParametersin interfaceio.micronaut.http.HttpRequest<B>
-
accept
public java.util.Collection<io.micronaut.http.MediaType> accept()
- Specified by:
acceptin interfaceio.micronaut.http.HttpRequest<B>
-
getContentType
public java.util.Optional<io.micronaut.http.MediaType> getContentType()
- Specified by:
getContentTypein interfaceio.micronaut.http.HttpMessage<B>
-
getCharacterEncoding
public java.nio.charset.Charset getCharacterEncoding()
- Specified by:
getCharacterEncodingin interfaceio.micronaut.http.HttpMessage<B>
-
getLocale
public java.util.Optional<java.util.Locale> getLocale()
-
getMethod
public io.micronaut.http.HttpMethod getMethod()
- Specified by:
getMethodin interfaceio.micronaut.http.HttpRequest<B>
-
getUri
public java.net.URI getUri()
- Specified by:
getUriin interfaceio.micronaut.http.HttpRequest<B>
-
getPath
public java.lang.String getPath()
- Specified by:
getPathin interfaceio.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:
getMethodNamein interfaceio.micronaut.http.HttpRequest<B>
-
-