Package io.micronaut.http.client.netty
Class NettyClientHttpRequest<B>
java.lang.Object
io.micronaut.http.client.netty.NettyClientHttpRequest<B>
- Type Parameters:
B
- The request body
- All Implemented Interfaces:
AttributeHolder
,MutableAttributeHolder
,ConversionServiceAware
,HttpMessage<B>
,HttpRequest<B>
,MutableHttpMessage<B>
,MutableHttpRequest<B>
,NettyHttpRequestBuilder
@Internal
public class NettyClientHttpRequest<B>
extends Object
implements MutableHttpRequest<B>, NettyHttpRequestBuilder
Default implementation of
MutableHttpRequest
for the HttpClient
.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
Method Summary
Modifier and TypeMethodDescription<T> MutableHttpRequest<T>
body
(T body) Sets the body.Sets the specified cookie on the request.Sets the specified cookies on the request.protected io.netty.handler.codec.http.QueryStringDecoder
createDecoder
(URI uri) AMutableConvertibleValues
of the attributes for this HTTP message.getBody()
<T> Optional<T>
getBody
(ArgumentConversionContext<T> conversionContext) Return the body, will use the provided conversion context if needed.<T> Optional<T>
Return the body as the given type.getUri()
boolean
isStream()
Deprecated.void
setConversionService
(ConversionService conversionService) Sets the conversion service.@NonNull io.netty.handler.codec.http.FullHttpRequest
Deprecated.@NonNull io.netty.handler.codec.http.HttpRequest
Deprecated.io.netty.handler.codec.http.HttpRequest
Convert this request to a netty request without the body.Deprecated.toString()
Sets the uri on the request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttribute
Methods inherited from interface io.micronaut.http.HttpMessage
getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getHttpVersion, getLocale, getOrigin, getPath, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute
Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
Methods inherited from interface io.micronaut.http.MutableHttpMessage
bodyWriter
Methods inherited from interface io.micronaut.http.MutableHttpRequest
accept, accept, basicAuth, bearerAuth, contentEncoding, contentLength, contentType, contentType, header, headers, headers, uri
Methods inherited from interface io.micronaut.http.netty.NettyHttpRequestBuilder
toHttpRequestDirect
-
Method Details
-
getHeaders
- Specified by:
getHeaders
in interfaceHttpMessage<B>
- Specified by:
getHeaders
in interfaceMutableHttpMessage<B>
- Specified by:
getHeaders
in interfaceMutableHttpRequest<B>
- Returns:
- The
HttpHeaders
object
-
getAttributes
Description copied from interface:HttpMessage
A
MutableConvertibleValues
of the attributes for this HTTP message.Attributes are designed for internal data sharing and hence are isolated from headers and parameters which are client supplied
- Specified by:
getAttributes
in interfaceAttributeHolder
- Specified by:
getAttributes
in interfaceHttpMessage<B>
- Specified by:
getAttributes
in interfaceMutableAttributeHolder
- Returns:
- The attributes of the message
-
cookie
Description copied from interface:MutableHttpRequest
Sets the specified cookie on the request.- Specified by:
cookie
in interfaceMutableHttpRequest<B>
- Parameters:
cookie
- the Cookie to return to the client- Returns:
- The http request
-
cookies
Description copied from interface:MutableHttpRequest
Sets the specified cookies on the request.- Specified by:
cookies
in interfaceMutableHttpRequest<B>
- Parameters:
cookies
- the Cookies to return to the client- Returns:
- The http request
-
uri
Description copied from interface:MutableHttpRequest
Sets the uri on the request.- Specified by:
uri
in interfaceMutableHttpRequest<B>
- Parameters:
uri
- The uri to call- Returns:
- The http request
-
getBody
- Specified by:
getBody
in interfaceHttpMessage<B>
- Returns:
- The request body
-
getBody
Description copied from interface:HttpMessage
Return the body as the given type.- Specified by:
getBody
in interfaceHttpMessage<B>
- Type Parameters:
T
- The generic type- Parameters:
type
- The type of the body- Returns:
- An
Optional
of the type orOptional.empty()
if the body cannot be returned as the given type
-
getBody
Description copied from interface:HttpMessage
Return the body, will use the provided conversion context if needed.- Specified by:
getBody
in interfaceHttpMessage<B>
- Type Parameters:
T
- The generic type- Parameters:
conversionContext
- The body conversion context- Returns:
- An
Optional
of the type orOptional.empty()
if the body cannot be returned as the given type
-
body
Description copied from interface:MutableHttpMessage
Sets the body.- Specified by:
body
in interfaceMutableHttpMessage<B>
- Specified by:
body
in interfaceMutableHttpRequest<B>
- Type Parameters:
T
- The new body type- Parameters:
body
- The body- Returns:
- This message
-
getCookies
- Specified by:
getCookies
in interfaceHttpRequest<B>
- Returns:
- The
Cookies
instance
-
getParameters
- Specified by:
getParameters
in interfaceHttpRequest<B>
- Specified by:
getParameters
in interfaceMutableHttpRequest<B>
- Returns:
- The HTTP parameters contained with the URI query string
-
getMethod
- Specified by:
getMethod
in interfaceHttpRequest<B>
- Returns:
- The request method
-
getUri
- Specified by:
getUri
in interfaceHttpRequest<B>
- Returns:
- The full request URI
-
createDecoder
- Parameters:
uri
- The URI- Returns:
- The query string decoder
-
toString
-
getMethodName
- Specified by:
getMethodName
in interfaceHttpRequest<B>
- Returns:
- The name of the method (same as
HttpMethod
value for standard http methods).
-
toFullHttpRequest
@NonNull @Deprecated public @NonNull io.netty.handler.codec.http.FullHttpRequest toFullHttpRequest()Deprecated.Description copied from interface:NettyHttpRequestBuilder
Converts this object to a full http request.- Specified by:
toFullHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- a full http request
-
toStreamHttpRequest
Deprecated.Description copied from interface:NettyHttpRequestBuilder
Converts this object to a streamed http request.- Specified by:
toStreamHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- The streamed request
-
toHttpRequest
Deprecated.Description copied from interface:NettyHttpRequestBuilder
Converts this object to the most appropriate http request type.- Specified by:
toHttpRequest
in interfaceNettyHttpRequestBuilder
- Returns:
- The http request
-
toHttpRequestWithoutBody
public io.netty.handler.codec.http.HttpRequest toHttpRequestWithoutBody()Description copied from interface:NettyHttpRequestBuilder
Convert this request to a netty request without the body. The caller will handle adding the body.- Specified by:
toHttpRequestWithoutBody
in interfaceNettyHttpRequestBuilder
- Returns:
- The request excluding the body
-
isStream
Deprecated.- Specified by:
isStream
in interfaceNettyHttpRequestBuilder
- Returns:
- Is the request a stream.
-
setConversionService
Description copied from interface:ConversionServiceAware
Sets the conversion service.- Specified by:
setConversionService
in interfaceConversionServiceAware
- Parameters:
conversionService
- The conversion service
-