public final class OutboundEvent extends Object implements jakarta.ws.rs.sse.OutboundSseEvent
| Modifier and Type | Class and Description |
|---|---|
static class |
OutboundEvent.Builder
Used for creating
OutboundEvent instances. |
| Modifier and Type | Method and Description |
|---|---|
String |
getComment()
Get a comment string that accompanies the event.
|
Object |
getData()
Get event data.
|
Type |
getGenericType()
Get generic data type.
|
String |
getId()
Get event identifier.
|
jakarta.ws.rs.core.MediaType |
getMediaType()
Get
media type of the event data. |
String |
getName()
Get event name.
|
long |
getReconnectDelay()
Get connection retry time in milliseconds the event receiver should wait before attempting to
reconnect after a connection to the SSE source is lost.
|
Class<?> |
getType()
Get data type.
|
boolean |
isReconnectDelaySet()
Check if the connection retry time has been set in the event.
|
public String getName()
This field is optional. If specified, will be send as a value of the SSE "event" field.
getName in interface jakarta.ws.rs.sse.SseEventnull if not set.public String getId()
This field is optional. If specified, the value is send as a value of the SSE "id" field.
getId in interface jakarta.ws.rs.sse.SseEventnull if not set.public long getReconnectDelay()
This field is optional. If specified, the value is send as a value of the SSE "retry" field.
getReconnectDelay in interface jakarta.ws.rs.sse.SseEventSseFeature.RECONNECT_NOT_SET if no value has been set.public boolean isReconnectDelaySet()
isReconnectDelaySet in interface jakarta.ws.rs.sse.SseEventtrue if reconnection delay in milliseconds has been set in the event, false otherwise.public Class<?> getType()
This information is used to select a proper MessageBodyWriter to be used for
serializing the event data.
getType in interface jakarta.ws.rs.sse.OutboundSseEventnull, if the event does not contain any data.public Type getGenericType()
This information is used to select a proper MessageBodyWriter to be used for
serializing the event data.
getGenericType in interface jakarta.ws.rs.sse.OutboundSseEventnull, if the event does not contain any data.public jakarta.ws.rs.core.MediaType getMediaType()
media type of the event data.
This information is used to a select proper MessageBodyWriter to be used for
serializing the event data.
getMediaType in interface jakarta.ws.rs.sse.OutboundSseEventMediaType.public String getComment()
If specified, the comment value is sent with the event as one or more SSE comment lines (depending on line breaks in the actual data string), before any actual event data are serialized. If the event instance does not contain any data, a separate "event" that contains only the comment will be sent. Comment information is optional, provided the event data are set.
getComment in interface jakarta.ws.rs.sse.SseEventpublic Object getData()
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 available MessageBodyWriter that is selected based on the event
type, getGenericType() generic type} and getMediaType() media type}.
getData in interface jakarta.ws.rs.sse.OutboundSseEventnull, if the event does not contain any data.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.