Package org.springframework.http.codec
Interface HttpMessageEncoder<T>
- Type Parameters:
T
- the type of elements in the input stream
- All Superinterfaces:
Encoder<T>
- All Known Implementing Classes:
AbstractJackson2Encoder
,Jackson2CborEncoder
,Jackson2JsonEncoder
,Jackson2SmileEncoder
,ProtobufEncoder
Extension of
Encoder
exposing extra methods relevant in the context
of HTTP request or response body encoding.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptiongetEncodeHints
(ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Get decoding hints based on the server request or annotations on the target controller method parameter.Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.Methods inherited from interface org.springframework.core.codec.Encoder
canEncode, encode, encodeValue, getEncodableMimeTypes, getEncodableMimeTypes
-
Method Details
-
getStreamingMediaTypes
Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream. -
getEncodeHints
default Map<String,Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType, @Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Get decoding hints based on the server request or annotations on the target controller method parameter.- Parameters:
actualType
- the actual source type to encode, possibly a reactive wrapper and sourced fromMethodParameter
, i.e. providing access to method annotations.elementType
- the element type withinFlux/Mono
that we're trying to encode.request
- the current requestresponse
- the current response- Returns:
- a Map with hints, possibly empty
-