public class OutboundSseEventImpl extends Object implements OutboundSseEvent
Modifier and Type | Class and Description |
---|---|
static class |
OutboundSseEventImpl.BuilderImpl |
OutboundSseEvent.Builder
RECONNECT_NOT_SET
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.
|
MediaType |
getMediaType()
Get
media type of the event data. |
String |
getName()
Get event name.
|
long |
getReconnectDelay()
Get new connection retry time in milliseconds the event receiver should wait before attempting to
reconnect after a connection to the SSE event source is lost.
|
Class<?> |
getType()
Get data type.
|
boolean |
isEscape() |
boolean |
isMediaTypeSet() |
boolean |
isReconnectDelaySet()
Check if the connection retry time has been set in the event.
|
void |
setEscape(Boolean escape) |
void |
setMediaType(MediaType mediaType) |
public String getName()
SseEvent
Contains value of SSE "event"
field. This field is optional. Method may return null
, if the event
name is not specified.
public String getId()
SseEvent
Contains value of SSE "id"
field. This field is optional. Method may return null
, if the event
identifier is not specified.
public long getReconnectDelay()
SseEvent
Contains value of SSE "retry"
field. This field is optional. Method returns SseEvent.RECONNECT_NOT_SET
if no value has been set.
getReconnectDelay
in interface SseEvent
SseEvent.RECONNECT_NOT_SET
if no value has been set.public boolean isReconnectDelaySet()
SseEvent
isReconnectDelaySet
in interface SseEvent
true
if new reconnection delay has been set in the event, false
otherwise.public Class<?> getType()
OutboundSseEvent
This information is used to select a proper MessageBodyWriter
to be used for
serializing the event data
.
getType
in interface OutboundSseEvent
null
, if the event does not contain any data.public Type getGenericType()
OutboundSseEvent
This information is used to select a proper MessageBodyWriter
to be used for
serializing the event data
.
getGenericType
in interface OutboundSseEvent
null
, if the event does not contain any data.public MediaType getMediaType()
OutboundSseEvent
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 OutboundSseEvent
MediaType
.public boolean isMediaTypeSet()
public void setMediaType(MediaType mediaType)
public String getComment()
SseEvent
Contains value of the comment associated with SSE event. This field is optional. Method may return null
,
if the event comment is not specified.
getComment
in interface SseEvent
public Object getData()
OutboundSseEvent
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
, OutboundSseEvent.getGenericType()
generic type} and OutboundSseEvent.getMediaType()
media type}.
getData
in interface OutboundSseEvent
null
, if the event does not contain any data.public boolean isEscape()
public void setEscape(Boolean escape)
Copyright © 2021 JBoss by Red Hat. All rights reserved.