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

      public interface HttpMessageEncoder<T>
      extends Encoder<T>

  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

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `List<MediaType>` | `getStreamingMediaTypes()` 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 Detail

    - #### getStreamingMediaTypes

          List<MediaType> 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 from `MethodParameter`, i.e. providing access to method annotations.
        `elementType` - the element type within `Flux/Mono` that we're trying to encode.
        `request` - the current request
        `response` - the current response
      Returns:
        a Map with hints, possibly empty