spring-framework / org.springframework.http.codec / ServerSentEventHttpMessageReader

ServerSentEventHttpMessageReader

open class ServerSentEventHttpMessageReader : HttpMessageReader<Any>

Reader that supports a stream of ServerSentEvents and also plain Objects which is the same as an ServerSentEvent with data only.

Author
Sebastien Deleuze

Author
Rossen Stoyanchev

Since
5.0

Constructors

<init>

ServerSentEventHttpMessageReader()

Constructor without a Decoder. In this mode only String is supported as the data of an event.

ServerSentEventHttpMessageReader(decoder: Decoder<*>)

Constructor with JSON Decoder for decoding to Objects. Support for decoding to String event data is built-in.

Functions

canRead

open fun canRead(elementType: ResolvableType, mediaType: MediaType): Boolean

getDecoder

open fun getDecoder(): Decoder<*>

Return the configured Decoder.

getReadableMediaTypes

open fun getReadableMediaTypes(): MutableList<MediaType>

read

open fun read(elementType: ResolvableType, message: ReactiveHttpInputMessage, hints: MutableMap<String, Any>): Flux<Any>

readMono

open fun readMono(elementType: ResolvableType, message: ReactiveHttpInputMessage, hints: MutableMap<String, Any>): Mono<Any>