public final class OutboundEvent extends Object implements javax.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.
|
javax.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 javax.ws.rs.sse.SseEvent
null
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 javax.ws.rs.sse.SseEvent
null
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 javax.ws.rs.sse.SseEvent
SseFeature.RECONNECT_NOT_SET
if no value has been set.public boolean isReconnectDelaySet()
isReconnectDelaySet
in interface javax.ws.rs.sse.SseEvent
true
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 javax.ws.rs.sse.OutboundSseEvent
null
, 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 javax.ws.rs.sse.OutboundSseEvent
null
, if the event does not contain any data.public javax.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 javax.ws.rs.sse.OutboundSseEvent
MediaType
.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 javax.ws.rs.sse.SseEvent
public 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 javax.ws.rs.sse.OutboundSseEvent
null
, 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.