spring-framework / org.springframework.http.codec.json / AbstractJackson2Encoder

AbstractJackson2Encoder

abstract class AbstractJackson2Encoder : Jackson2CodecSupport, HttpMessageEncoder<Any>

Base class providing support methods for Jackson 2.9 encoding.

Author
Sebastien Deleuze

Author
Arjen Poutsma

Since
5.0

Functions

canEncode

open fun canEncode(elementType: ResolvableType, mimeType: MimeType): Boolean

encode

open fun encode(inputStream: Publisher<*>, bufferFactory: DataBufferFactory, elementType: ResolvableType, mimeType: MimeType, hints: MutableMap<String, Any>): Flux<DataBuffer>

getEncodeHints

open fun getEncodeHints(actualType: ResolvableType, elementType: ResolvableType, mediaType: MediaType, request: ServerHttpRequest, response: ServerHttpResponse): MutableMap<String, Any>

getStreamingMediaTypes

open fun getStreamingMediaTypes(): MutableList<MediaType>

setStreamingMediaTypes

open fun setStreamingMediaTypes(mediaTypes: MutableList<MediaType>): Unit

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

By default this is set to MediaType#APPLICATION_STREAM_JSON.

Inheritors

Jackson2JsonEncoder

open class Jackson2JsonEncoder : AbstractJackson2Encoder

Encode from an Object stream to a byte stream of JSON objects, using Jackson 2.9.

Jackson2SmileEncoder

open class Jackson2SmileEncoder : AbstractJackson2Encoder

Encode from an Object stream to a byte stream of Smile objects using Jackson 2.9.