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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAMutableConvertibleValuesof 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, waitMethods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttributeMethods inherited from interface io.micronaut.http.HttpMessage
getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getLocale, setAttributeMethods 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:
getHeadersin interfaceHttpMessage<B>- Returns:
- The
HttpHeadersobject
-
getAttributes
Description copied from interface:HttpMessageA
MutableConvertibleValuesof 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:
getAttributesin interfaceAttributeHolder- Specified by:
getAttributesin interfaceHttpMessage<B>- Specified by:
getAttributesin interfaceMutableAttributeHolder- Returns:
- The attributes of the message
-
getBody
- Specified by:
getBodyin interfaceHttpMessage<B>- Returns:
- The request body
-
getBody
Description copied from interface:HttpMessageReturn the body as the given type.- Specified by:
getBodyin interfaceHttpMessage<B>- Type Parameters:
T- The generic type- Parameters:
type- The type of the body- Returns:
- An
Optionalof the type orOptional.empty()if the body cannot be returned as the given type
-
getBody
Description copied from interface:HttpMessageReturn the body as the given type.- Specified by:
getBodyin interfaceHttpMessage<B>- Type Parameters:
T- The generic type- Parameters:
type- The type of the body- Returns:
- An
Optionalof the type orOptional.empty()if the body cannot be returned as the given type
-
getBody
Description copied from interface:HttpMessageReturn the body, will use the provided conversion context if needed.- Specified by:
getBodyin interfaceHttpMessage<B>- Type Parameters:
T- The generic type- Parameters:
conversionContext- The body conversion context- Returns:
- An
Optionalof the type orOptional.empty()if the body cannot be returned as the given type
-