org.springframework.http.codec

Class ServerSentEventHttpMessageWriter

  • java.lang.Object
    • org.springframework.http.codec.ServerSentEventHttpMessageWriter
  • All Implemented Interfaces:
    HttpMessageWriter<java.lang.Object>


    public class ServerSentEventHttpMessageWriter
    extends java.lang.Object
    implements HttpMessageWriter<java.lang.Object>
    HttpMessageWriter for "text/event-stream" responses.
    Since:
    5.0
    Author:
    Sebastien Deleuze, Arjen Poutsma, Rossen Stoyanchev
    • Constructor Detail

      • ServerSentEventHttpMessageWriter

        public ServerSentEventHttpMessageWriter()
        Constructor without an Encoder. In this mode only String is supported for event data to be encoded.
      • ServerSentEventHttpMessageWriter

        public ServerSentEventHttpMessageWriter(@Nullable
                                                Encoder<?> encoder)
        Constructor with JSON Encoder for encoding objects. Support for String event data is built-in.
        Parameters:
        encoder - the Encoder to use (may be null)