- All Superinterfaces:
SseEvent
Representation of a single outbound Server-sent event.
Used on the server side, when creating and sending an event to a client or when broadcasting.
- Since:
- 2.1
- Author:
- Marek Potociar
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A builder class used for creatingOutboundSseEvent
instances. -
Field Summary
Fields inherited from interface jakarta.ws.rs.sse.SseEvent
RECONNECT_NOT_SET
-
Method Summary
Modifier and TypeMethodDescriptiongetData()
Get event data.Get generic data type.Getmedia type
of the event data.Class
<?> getType()
Get data type.Methods inherited from interface jakarta.ws.rs.sse.SseEvent
getComment, getId, getName, getReconnectDelay, isReconnectDelaySet
-
Method Details
-
getType
Class<?> getType()Get data type.This information is used to select a proper
MessageBodyWriter
to be used for serializing theevent data
.- Returns:
- data type. May return
null
, if the event does not contain any data.
-
getGenericType
Type getGenericType()Get generic data type.This information is used to select a proper
MessageBodyWriter
to be used for serializing theevent data
.- Returns:
- generic data type. May return
null
, if the event does not contain any data.
-
getMediaType
MediaType getMediaType()Getmedia type
of the event data.This information is used to a select proper
MessageBodyWriter
to be used for serializing theevent data
.- Returns:
- data
MediaType
.
-
getData
Object getData()Get event data.The event data, if specified, are serialized and sent as one or more SSE event
"data"
fields (depending on the line breaks in the actual serialized data content). The data are serialized using an availableMessageBodyWriter
that is selected based on the eventtype
,getGenericType()
generic type} andgetMediaType()
media type}.- Returns:
- event data. May return
null
, if the event does not contain any data.
-