Class OutboundSseEventImpl

java.lang.Object
org.jboss.resteasy.plugins.providers.sse.OutboundSseEventImpl
All Implemented Interfaces:
OutboundSseEvent, SseEvent

public class OutboundSseEventImpl extends Object implements OutboundSseEvent
  • Method Details

    • getName

      public String getName()
      Description copied from interface: SseEvent
      Get event name.

      Contains value of SSE "event" field. This field is optional. Method may return null, if the event name is not specified.

      Specified by:
      getName in interface SseEvent
      Returns:
      event name, or null if not set.
    • getId

      public String getId()
      Description copied from interface: SseEvent
      Get event identifier.

      Contains value of SSE "id" field. This field is optional. Method may return null, if the event identifier is not specified.

      Specified by:
      getId in interface SseEvent
      Returns:
      event id.
    • getReconnectDelay

      public long getReconnectDelay()
      Description copied from interface: SseEvent
      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.

      Contains value of SSE "retry" field. This field is optional. Method returns SseEvent.RECONNECT_NOT_SET if no value has been set.

      Specified by:
      getReconnectDelay in interface SseEvent
      Returns:
      reconnection delay in milliseconds or SseEvent.RECONNECT_NOT_SET if no value has been set.
    • isReconnectDelaySet

      public boolean isReconnectDelaySet()
      Description copied from interface: SseEvent
      Check if the connection retry time has been set in the event.
      Specified by:
      isReconnectDelaySet in interface SseEvent
      Returns:
      true if new reconnection delay has been set in the event, false otherwise.
    • getType

      public Class<?> getType()
      Description copied from interface: OutboundSseEvent
      Get data type.

      This information is used to select a proper MessageBodyWriter to be used for serializing the event data.

      Specified by:
      getType in interface OutboundSseEvent
      Returns:
      data type. May return null, if the event does not contain any data.
    • getGenericType

      public Type getGenericType()
      Description copied from interface: OutboundSseEvent
      Get generic data type.

      This information is used to select a proper MessageBodyWriter to be used for serializing the event data.

      Specified by:
      getGenericType in interface OutboundSseEvent
      Returns:
      generic data type. May return null, if the event does not contain any data.
    • getMediaType

      public MediaType getMediaType()
      Description copied from interface: OutboundSseEvent
      Get media type of the event data.

      This information is used to a select proper MessageBodyWriter to be used for serializing the event data.

      Specified by:
      getMediaType in interface OutboundSseEvent
      Returns:
      data MediaType.
    • isMediaTypeSet

      public boolean isMediaTypeSet()
    • setMediaType

      public void setMediaType(MediaType mediaType)
    • getComment

      public String getComment()
      Description copied from interface: SseEvent
      Get a comment string that accompanies the event.

      Contains value of the comment associated with SSE event. This field is optional. Method may return null, if the event comment is not specified.

      Specified by:
      getComment in interface SseEvent
      Returns:
      comment associated with the event.
    • getData

      public Object getData()
      Description copied from interface: OutboundSseEvent
      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 available MessageBodyWriter that is selected based on the event type, OutboundSseEvent.getGenericType() generic type} and OutboundSseEvent.getMediaType() media type}.

      Specified by:
      getData in interface OutboundSseEvent
      Returns:
      event data. May return null, if the event does not contain any data.
    • isEscape

      public boolean isEscape()
    • setEscape

      public void setEscape(Boolean escape)