B - The body typepublic interface HttpMessage<B>
extends io.micronaut.core.attr.MutableAttributeHolder
HttpRequest,
HttpResponse| Modifier and Type | Method and Description |
|---|---|
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
getAttributes()
A
MutableConvertibleValues of the attributes for this HTTP message. |
java.util.Optional<B> |
getBody() |
default <T> java.util.Optional<T> |
getBody(io.micronaut.core.type.Argument<T> type)
Return the body as the given type.
|
default <T> java.util.Optional<T> |
getBody(java.lang.Class<T> type)
Return the body as the given type.
|
default java.nio.charset.Charset |
getCharacterEncoding() |
default long |
getContentLength() |
default java.util.Optional<MediaType> |
getContentType()
The request or response content type.
|
HttpHeaders |
getHeaders() |
default java.util.Optional<java.util.Locale> |
getLocale() |
default HttpMessage<B> |
setAttribute(java.lang.CharSequence name,
java.lang.Object value) |
@NonNull HttpHeaders getHeaders()
HttpHeaders object@NonNull io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> getAttributes()
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
getAttributes in interface io.micronaut.core.attr.AttributeHoldergetAttributes in interface io.micronaut.core.attr.MutableAttributeHolder@NonNull java.util.Optional<B> getBody()
@NonNull default java.nio.charset.Charset getCharacterEncoding()
StandardCharsets.UTF_8@NonNull default HttpMessage<B> setAttribute(@NonNull java.lang.CharSequence name, java.lang.Object value)
setAttribute in interface io.micronaut.core.attr.MutableAttributeHolder@NonNull
default <T> java.util.Optional<T> getBody(@NonNull
io.micronaut.core.type.Argument<T> type)
T - The generic typetype - The type of the bodyOptional of the type or Optional.empty() if the body cannot be returned as the given type@NonNull
default <T> java.util.Optional<T> getBody(@NonNull
java.lang.Class<T> type)
T - The generic typetype - The type of the bodyOptional of the type or Optional.empty() if the body cannot be returned as the given type@NonNull default java.util.Optional<java.util.Locale> getLocale()
default long getContentLength()
@NonNull default java.util.Optional<MediaType> getContentType()