HttpMessageWriter for "text/event-stream" responses.
| Modifier and Type | Field and Description |
|---|---|
| private static final MediaType | |
| private final Encoder | |
| private static final Log | |
| private static final List |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ServerSentEventHttpMessageWriter(Encoder<?>
the Encoder to use (may be encoder)null)Constructor with JSON |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canWrite(ResolvableType
the type of object to check elementType, MediaType the media type for the write (possibly mediaType)null)Implements org. Whether the given object type is supported by this writer. |
| private Flux | encode(Publisher<?> input, ResolvableType elementType, MediaType mediaType, DataBufferFactory factory, Map<String, Object> hints)
|
| private <T> Flux | encodeEvent(StringBuilder eventContent, T data, ResolvableType dataType, MediaType mediaType, DataBufferFactory factory, Map<String, Object> hints)
|
| private DataBuffer | |
| private Map | getEncodeHints(ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response)
|
| public Encoder | |
| public List | getWritableMediaTypes()
Implements org. Return the list of media types supported by this Writer. |
| public Mono | write(Publisher<?>
the objects to write input, ResolvableType the type of objects in the stream which must have been
previously checked via elementType, MediaType canWrite(ResolvableType, MediaType)the content type for the write (possibly mediaType, ReactiveHttpOutputMessage null to
indicate that the default content type of the writer must be used)the message to write to message, Map<String, Object> additional information about how to encode and write hints)Implements org. Write a given stream of object to the output message. |
| public Mono | write(Publisher<?> input, ResolvableType
the actual return type of the method that returned the
value; for annotated controllers, the actualType, ResolvableType MethodParameter can be
accessed via ResolvableType#getSource().the type of Objects in the input stream elementType, MediaType the content type to use (possibly mediaType, ServerHttpRequest null indicating
the default content type of the writer should be used)the current request request, ServerHttpResponse the current response response, Map<String, Object> hints)Overrides default org. Server-side only alternative to
|
| private void |
| DEFAULT_MEDIA_TYPE | back to summary |
|---|---|
| private static final MediaType DEFAULT_MEDIA_TYPE | |
| encoder | back to summary |
|---|---|
| private final Encoder<?> encoder
| |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| WRITABLE_MEDIA_TYPES | back to summary |
|---|---|
| private static final List<MediaType> WRITABLE_MEDIA_TYPES | |
| ServerSentEventHttpMessageWriter | back to summary |
|---|---|
| public ServerSentEventHttpMessageWriter() Constructor without an | |
| ServerSentEventHttpMessageWriter | back to summary |
|---|---|
| public ServerSentEventHttpMessageWriter(Encoder<?> encoder) Constructor with JSON
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(ResolvableType elementType, MediaType mediaType) Implements org. Doc from org. Whether the given object type is supported by this writer.
| |
| encode | back to summary |
|---|---|
| private Flux | |
| encodeEvent | back to summary |
|---|---|
private <T> Flux
| |
| encodeText | back to summary |
|---|---|
| private DataBuffer encodeText(CharSequence text, MediaType mediaType, DataBufferFactory bufferFactory) | |
| getEncodeHints | back to summary |
|---|---|
| private Map | |
| getEncoder | back to summary |
|---|---|
| public Encoder Return the configured
| |
| getWritableMediaTypes | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of media types supported by this Writer. The list may not
apply to every possible target element type and calls to this method should
typically be guarded via | |
| write | back to summary |
|---|---|
| public Mono Implements org. Doc from org. Write a given stream of object to the output message.
| |
| write | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Server-side only alternative to
| |
| writeField | back to summary |
|---|---|
| private void writeField(String fieldName, Object fieldValue, StringBuilder sb) | |