Package io.micronaut.http.server.netty
Class AbstractNettyHttpRequest<B>
java.lang.Object
io.netty.util.DefaultAttributeMap
io.micronaut.http.server.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
FieldsModifier and TypeFieldDescriptionprotected final ConversionServiceprotected final HttpMethodprotected final Stringprotected final io.netty.handler.codec.http.HttpRequestprotected final StringFields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, ConversionService conversionService, boolean escapeHtmlUrl) -
Method Summary
Modifier and TypeMethodDescriptionprotected final io.netty.handler.codec.http.QueryStringDecodercreateDecoder(URI uri) protected abstract intio.netty.handler.codec.http.HttpRequestgetPath()getUri()protected abstract CharsetinitCharset(Charset characterEncoding) protected abstract booleanbooleanisStream()io.netty.handler.codec.http.FullHttpRequestConverts this object to a full http request.io.netty.handler.codec.http.HttpRequestConverts 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, hasAttrMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttributeMethods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getContentLength, getContentType, getHeadersMethods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getCookies, getHttpVersion, getLocale, getOrigin, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute, setUserPrincipal, toMutableRequestMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttributeMethods inherited from interface io.micronaut.http.netty.NettyHttpRequestBuilder
byteBodyDirect, 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, boolean escapeHtmlUrl) - Parameters:
nettyRequest- The Http netty requestconversionService- The conversion serviceescapeHtmlUrl-HttpServerConfiguration.isEscapeHtmlUrl()
-
-
Method Details
-
toHttpRequest
Description copied from interface:NettyHttpRequestBuilderConverts this object to the most appropriate http request type.- Specified by:
toHttpRequestin interfaceNettyHttpRequestBuilder- Returns:
- The http request
-
toFullHttpRequest
Description copied from interface:NettyHttpRequestBuilderConverts this object to a full http request.- Specified by:
toFullHttpRequestin interfaceNettyHttpRequestBuilder- Returns:
- a full http request
-
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.
-
getNettyRequest
public io.netty.handler.codec.http.HttpRequest getNettyRequest()- Returns:
- The native netty request
-
getParameters
- Specified by:
getParametersin interfaceHttpRequest<B>- Returns:
- The HTTP parameters contained with the URI query string
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfaceHttpMessage<B>- Returns:
- The request character encoding. Defaults to
StandardCharsets.UTF_8
-
getMethod
- Specified by:
getMethodin interfaceHttpRequest<B>- Returns:
- The request method
-
getUri
- Specified by:
getUriin interfaceHttpRequest<B>- Returns:
- The full request URI
-
getPath
- Specified by:
getPathin interfaceHttpRequest<B>- Returns:
- Get the raw, percent-encoded path without any parameters
-
initCharset
- 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:
trueif yes,falseotherwise.
-
createDecoder
- Parameters:
uri- The URI- Returns:
- The query string decoder
-
getMethodName
- Specified by:
getMethodNamein interfaceHttpRequest<B>- Returns:
- The name of the method (same as
HttpMethodvalue for standard http methods).
-