Interface ServerResponse.SseBuilder
- All Superinterfaces:
- ServerResponse.AsyncBuilder<ServerResponse.SseBuilder>
- Enclosing interface:
- ServerResponse
public static interface ServerResponse.SseBuilder
extends ServerResponse.AsyncBuilder<ServerResponse.SseBuilder>
Defines a builder for a body that sends server-sent events.
- Since:
- 5.3.2
- 
Method SummaryModifier and TypeMethodDescriptionAdd an SSE comment.voidAdd an SSE "data" line for the given object and sends the built server-sent event to the client.Add an SSE "event" line.Add an SSE "id" line.Add an SSE "retry" line.voidsend()Sends the buffered content as a server-sent event, without data.voidSends the given object as a server-sent event.Methods inherited from interface org.springframework.web.servlet.function.ServerResponse.AsyncBuildercomplete, error, onComplete, onError, onTimeout
- 
Method Details- 
sendSends the given object as a server-sent event. Strings will be sent as UTF-8 encoded bytes, and other objects will be converted into JSON using message converters.This convenience method has the same effect as data(Object).- Parameters:
- object- the object to send
- Throws:
- IOException- in case of I/O errors
 
- 
sendSends the buffered content as a server-sent event, without data. Only theeventsandcommentswill be sent.- Throws:
- IOException- in case of I/O errors
- Since:
- 6.1.4
 
- 
idAdd an SSE "id" line.- Parameters:
- id- the event identifier
- Returns:
- this builder
 
- 
eventAdd an SSE "event" line.- Parameters:
- eventName- the event name
- Returns:
- this builder
 
- 
retryAdd an SSE "retry" line.- Parameters:
- duration- the duration to convert into millis
- Returns:
- this builder
 
- 
commentAdd an SSE comment.- Parameters:
- comment- the comment
- Returns:
- this builder
 
- 
dataAdd an SSE "data" line for the given object and sends the built server-sent event to the client. Strings will be sent as UTF-8 encoded bytes, and other objects will be converted into JSON using message converters.- Parameters:
- object- the object to send as data
- Throws:
- IOException- in case of I/O errors
 
 
-