Interface HttpMessage<B>
- Type Parameters:
B- The body type
- All Superinterfaces:
AttributeHolder, MutableAttributeHolder
- All Known Subinterfaces:
ByteBodyHttpResponse<B>, FormCapableHttpRequest<B>, FullHttpRequest<B>, HttpRequest<B>, HttpResponse<B>, LifecycleHttpRequest<B>, MutableHttpMessage<B>, MutableHttpRequest<B>, MutableHttpResponse<B>, PushCapableHttpRequest<B>, ServerHttpRequest<B>
- All Known Implementing Classes:
AbstractNettyHttpRequest, ByteBodyHttpResponseWrapper, FullNettyClientHttpResponse, HttpMessageWrapper, HttpRequestWrapper, HttpResponseAdapter, HttpResponseWrapper, MutableHttpRequestWrapper, NettyClientHttpRequest, NettyHttpRequest, NettyMutableHttpResponse, SimpleHttpRequest
Common interface for HTTP messages.
- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAMutableConvertibleValuesof the attributes for this HTTP message.getBody()default <T> Optional<T> getBody(ArgumentConversionContext<T> conversionContext) Return the body, will use the provided conversion context if needed.default <T> Optional<T> Return the body as the given type.default <T> Optional<T> Return the body as the given type.default Optional<MessageBodyWriter<B>> default Charsetdefault longThe request or response content type.default HttpMessage<B> setAttribute(CharSequence name, @Nullable Object value) Sets an attribute on the message.Methods inherited from interface AttributeHolder
getAttribute, getAttributeMethods inherited from interface MutableAttributeHolder
removeAttribute
-
Method Details
-
getHeaders
HttpHeaders getHeaders()- Returns:
- The
HttpHeadersobject
-
getAttributes
MutableConvertibleValues<Object> getAttributes()A
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 interfaceMutableAttributeHolder- Returns:
- The attributes of the message
-
getBody
-
getBodyWriter
- Returns:
- The body writer.
- Since:
- 4.0.0
-
getCharacterEncoding
- Returns:
- The request character encoding. Defaults to
StandardCharsets.UTF_8
-
setAttribute
Description copied from interface:MutableAttributeHolderSets an attribute on the message.- Specified by:
setAttributein interfaceMutableAttributeHolder- Parameters:
name- The name of the attributevalue- The value of the attribute- Returns:
- This message
-
getBody
Return the body as the given type.- 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
Return the body, will use the provided conversion context if needed.- 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 - Since:
- 4.0.0
-
getBody
Return the body as the given type.- 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
-
getLocale
-
getContentLength
default long getContentLength()- Returns:
- The value of the Content-Length header or -1L if none specified
-
getContentType
-