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:
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 Summary
Modifier and TypeFieldDescriptionprotected final ConversionService
protected final HttpMethod
protected final String
protected final io.netty.handler.codec.http.HttpRequest
protected final String
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
Constructor Summary
ConstructorDescriptionAbstractNettyHttpRequest
(io.netty.handler.codec.http.HttpRequest nettyRequest, ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionprotected final io.netty.handler.codec.http.QueryStringDecoder
createDecoder
(URI uri) io.netty.handler.codec.http.HttpRequest
getPath()
getUri()
protected abstract Charset
initCharset
(Charset characterEncoding) boolean
isStream()
io.netty.handler.codec.http.FullHttpRequest
Converts this object to a full http request.io.netty.handler.codec.http.HttpRequest
Converts this object to the most appropriate http request type.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, getBody, getBodyWriter, getContentLength, getContentType, getHeaders
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getCookies, getHttpVersion, getLocale, getOrigin, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute, toMutableRequest
Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
Methods inherited from interface io.micronaut.http.netty.NettyHttpRequestBuilder
toHttpRequestDirect, toHttpRequestWithoutBody
-
Field Details
-
nettyRequest
protected final io.netty.handler.codec.http.HttpRequest nettyRequest -
conversionService
-
httpMethod
-
unvalidatedUrl
-
httpMethodName
-
-
Constructor Details
-
AbstractNettyHttpRequest
public AbstractNettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, ConversionService conversionService) - Parameters:
nettyRequest
- The Http netty requestconversionService
- The conversion service
-
-
Method Details
-
toHttpRequest
Description copied from interface:NettyHttpRequestBuilder
Converts this object to the most appropriate http request type.- Specified by:
toHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- The http request
-
toFullHttpRequest
Description copied from interface:NettyHttpRequestBuilder
Converts this object to a full http request.- Specified by:
toFullHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- a full http request
-
toStreamHttpRequest
Description copied from interface:NettyHttpRequestBuilder
Converts this object to a streamed http request.- Specified by:
toStreamHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- The streamed request
-
isStream
public boolean isStream()- Specified by:
isStream
in interfaceNettyHttpRequestBuilder
- Returns:
- Is the request a stream.
-
getNettyRequest
public io.netty.handler.codec.http.HttpRequest getNettyRequest()- Returns:
- The native netty request
-
getParameters
- Specified by:
getParameters
in interfaceHttpRequest<B>
- Returns:
- The HTTP parameters contained with the URI query string
-
getCharacterEncoding
- Specified by:
getCharacterEncoding
in interfaceHttpMessage<B>
- Returns:
- The request character encoding. Defaults to
StandardCharsets.UTF_8
-
getMethod
- Specified by:
getMethod
in interfaceHttpRequest<B>
- Returns:
- The request method
-
getUri
- Specified by:
getUri
in interfaceHttpRequest<B>
- Returns:
- The full request URI
-
getPath
- Specified by:
getPath
in interfaceHttpRequest<B>
- Returns:
- Get the raw, percent-encoded path without any parameters
-
initCharset
- Parameters:
characterEncoding
- The character encoding- Returns:
- The Charset
-
createDecoder
- Parameters:
uri
- The URI- Returns:
- The query string decoder
-
getMethodName
- Specified by:
getMethodName
in interfaceHttpRequest<B>
- Returns:
- The name of the method (same as
HttpMethod
value for standard http methods).
-