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 URI
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 TypeMethodDescriptionaccept()
A list of acceptedMediaType
instances sorted by their quality rating.protected final io.netty.handler.codec.http.QueryStringDecoder
createDecoder
(URI uri) The request or response content type.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, getHeaders
Methods inherited from interface io.micronaut.http.HttpRequest
getCertificate, getCookies, getHttpVersion, getOrigin, getRemoteAddress, getServerAddress, getServerName, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute
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
-
uri
-
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
-
accept
Description copied from interface:HttpRequest
A list of acceptedMediaType
instances sorted by their quality rating.- Specified by:
accept
in interfaceHttpRequest<B>
- Returns:
- A list of zero or many
MediaType
instances
-
getContentType
Description copied from interface:HttpMessage
The request or response content type.- Specified by:
getContentType
in interfaceHttpMessage<B>
- Returns:
- The content type
-
getCharacterEncoding
- Specified by:
getCharacterEncoding
in interfaceHttpMessage<B>
- Returns:
- The request character encoding. Defaults to
StandardCharsets.UTF_8
-
getLocale
- Specified by:
getLocale
in interfaceHttpMessage<B>
- Specified by:
getLocale
in interfaceHttpRequest<B>
- Returns:
- The locale of the message
-
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 charactger 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).
-