B
- The body typepublic interface HttpMessage<B> extends MutableAttributeHolder
HttpRequest
,
HttpResponse
Modifier and Type | Method and Description |
---|---|
MutableConvertibleValues<Object> |
getAttributes()
A
MutableConvertibleValues of the attributes for this HTTP message. |
Optional<B> |
getBody() |
default <T> Optional<T> |
getBody(Argument<T> type)
Return the body as the given type.
|
default <T> Optional<T> |
getBody(Class<T> type)
Return the body as the given type.
|
default Charset |
getCharacterEncoding() |
default long |
getContentLength() |
default Optional<MediaType> |
getContentType()
The request or response content type.
|
HttpHeaders |
getHeaders() |
default Optional<Locale> |
getLocale() |
default HttpMessage<B> |
setAttribute(CharSequence name,
Object value)
Sets an attribute on the message.
|
removeAttribute
getAttribute, getAttribute
@Nonnull HttpHeaders getHeaders()
HttpHeaders
object@Nonnull MutableConvertibleValues<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 AttributeHolder
getAttributes
in interface MutableAttributeHolder
@Nonnull default Charset getCharacterEncoding()
StandardCharsets.UTF_8
@Nonnull default HttpMessage<B> setAttribute(@Nonnull CharSequence name, Object value)
MutableAttributeHolder
setAttribute
in interface MutableAttributeHolder
name
- The name of the attributevalue
- The value of the attribute@Nonnull default <T> Optional<T> getBody(@Nonnull 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> Optional<T> getBody(@Nonnull 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 typedefault long getContentLength()