Package io.micronaut.http
Class HttpMessageWrapper<B>
java.lang.Object
io.micronaut.http.HttpMessageWrapper<B>
- Type Parameters:
B
- The message body
- All Implemented Interfaces:
AttributeHolder
,MutableAttributeHolder
,HttpMessage<B>
- Direct Known Subclasses:
HttpRequestWrapper
,HttpResponseWrapper
A wrapper around an
HttpMessage
.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAMutableConvertibleValues
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.<T> Optional<T>
Return the body as the given type.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
getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getLocale, setAttribute
Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Constructor Details
-
HttpMessageWrapper
- Parameters:
delegate
- The Http message
-
-
Method Details
-
getDelegate
- Returns:
- The Http message
-
getHeaders
- Specified by:
getHeaders
in interfaceHttpMessage<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
-
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 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
-