public class InboundEvent extends Object implements jakarta.ws.rs.sse.InboundSseEvent
| Modifier and Type | Method and Description | 
|---|---|
String | 
getComment()
Get a comment string that accompanies the event. 
 | 
String | 
getId()
Get event identifier. 
 | 
String | 
getName()
Get event name. 
 | 
byte[] | 
getRawData()
Get the raw event data bytes. 
 | 
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. 
 | 
boolean | 
isEmpty()
Check if the event is empty (i.e. 
 | 
boolean | 
isReconnectDelaySet()
Check if the connection retry time has been set in the event. 
 | 
String | 
readData()
Get the original event data string  
String. | 
<T> T | 
readData(Class<T> type)
Read event data as a given Java type. 
 | 
<T> T | 
readData(Class<T> messageType,
        jakarta.ws.rs.core.MediaType mediaType)
Read event data as a given Java type. 
 | 
<T> T | 
readData(jakarta.ws.rs.core.GenericType<T> type)
Read event data as a given generic type. 
 | 
<T> T | 
readData(jakarta.ws.rs.core.GenericType<T> type,
        jakarta.ws.rs.core.MediaType mediaType)
Read event data as a given generic type. 
 | 
String | 
toString()  | 
public String getName()
 Contains value of SSE "event" field. This field is optional. Method may return null, if the event
 name is not specified.
 
getName in interface jakarta.ws.rs.sse.SseEventnull if not set.public String getId()
 Contains value of SSE "id" field. This field is optional. Method may return null, if the event
 identifier is not specified.
 
getId in interface jakarta.ws.rs.sse.SseEventpublic String getComment()
 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 jakarta.ws.rs.sse.SseEventpublic long getReconnectDelay()
 Contains value of SSE "retry" field. This field is optional. Method returns SseFeature.RECONNECT_NOT_SET
 if no value has been set.
 
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 new reconnection delay has been set in the event, false otherwise.public boolean isEmpty()
isEmpty in interface jakarta.ws.rs.sse.InboundSseEventtrue if current instance does not contain any data, false otherwise.public String readData()
String.readData in interface jakarta.ws.rs.sse.InboundSseEventjakarta.ws.rs.ProcessingException - when provided type can't be read. The thrown exception wraps the original cause.public <T> T readData(Class<T> type)
readData in interface jakarta.ws.rs.sse.InboundSseEventtype - Java type to be used for event data de-serialization.jakarta.ws.rs.ProcessingException - when provided type can't be read. The thrown exception wraps the original cause.public <T> T readData(jakarta.ws.rs.core.GenericType<T> type)
readData in interface jakarta.ws.rs.sse.InboundSseEventtype - generic type to be used for event data de-serialization.jakarta.ws.rs.ProcessingException - when provided type can't be read. The thrown exception wraps the original cause.public <T> T readData(Class<T> messageType, jakarta.ws.rs.core.MediaType mediaType)
readData in interface jakarta.ws.rs.sse.InboundSseEventmessageType - Java type to be used for event data de-serialization.mediaType - media type to be used for event data de-serialization.jakarta.ws.rs.ProcessingException - when provided type can't be read. The thrown exception wraps the original cause.public <T> T readData(jakarta.ws.rs.core.GenericType<T> type,
                      jakarta.ws.rs.core.MediaType mediaType)
readData in interface jakarta.ws.rs.sse.InboundSseEventtype - generic type to be used for event data de-serialization.mediaType - media type to be used for event data de-serialization.jakarta.ws.rs.ProcessingException - when provided type can't be read. The thrown exception wraps the original cause.public byte[] getRawData()
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.