Top Description Methods
org.springframework.http.codec

public Interface HttpMessageEncoder<T>

extends Encoder<T>
Known Direct Implementers
org.springframework.http.codec.json.AbstractJackson2Encoder, org.springframework.http.codec.protobuf.ProtobufEncoder
Type Parameters
<T>
the type of elements in the input stream
Imports
java.util.List, .Map, org.springframework.core.ResolvableType, org.springframework.core.codec.Encoder, .Hints, org.springframework.http.MediaType, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable

Extension of Encoder exposing extra methods relevant in the context of HTTP request or response body encoding.
Author
Rossen Stoyanchev
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public default Map<String, Object>

Returns:

a Map with hints, possibly empty
getEncodeHints
(ResolvableType
the actual source type to encode, possibly a reactive wrapper and sourced from org.springframework.core.MethodParameter, i.e. providing access to method annotations.
actualType
,
ResolvableType
the element type within Flux/Mono that we're trying to encode.
elementType
,
MediaType mediaType, ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
)

Get decoding hints based on the server request or annotations on the target controller method parameter.

public List<MediaType>
getStreamingMediaTypes()

Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.

Inherited from org.springframework.core.codec.Encoder:
canEncodeencodeencodeValuegetEncodableMimeTypesgetEncodableMimeTypes

Method Detail

getEncodeHintsback to summary
public default Map<String, Object> getEncodeHints(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.

Parameters
actualType:ResolvableType

the actual source type to encode, possibly a reactive wrapper and sourced from org.springframework.core.MethodParameter, i.e. providing access to method annotations.

elementType:ResolvableType

the element type within Flux/Mono that we're trying to encode.

request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

Returns:Map<String, Object>

a Map with hints, possibly empty

getStreamingMediaTypesback to summary
public List<MediaType> getStreamingMediaTypes()

Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.