Class SilverpeasServerEventWebSocket

  • Direct Known Subclasses:
    CommonServerEventWebSocket

    public abstract class SilverpeasServerEventWebSocket
    extends Object
    This abstraction defines the behavior the Servlets in charge of responding to EventSource JavaScript API must have.
    Finally, adding a new URI to handle EventSource needs to extends this class and to parametrize the mapping! (see CommonServerSentEventServlet as an example)
    Author:
    Yohann Chastagnier
    • Constructor Detail

      • SilverpeasServerEventWebSocket

        public SilverpeasServerEventWebSocket()
    • Method Detail

      • getTokenParameterName

        protected abstract String getTokenParameterName()
        Gets the name of the parameter representing the token generated for current authenticated user and passed in the URI of the WebSocket endpoint.

        For example: With the @ServerEndpoint("/ws/{token}/sse/common") declaration, "token" MUST be returned by this method.

        Returns:
        a string representing the parameter name for the token.
      • getSessionInfo

        protected SessionInfo getSessionInfo​(javax.websocket.Session wsSession)
        This method is called one time only, when onOpen(Session) is executed.
        Parameters:
        wsSession - a WebSocket session instance.
        Returns:
        a SessionInfo instance.
      • onClose

        public void onClose​(javax.websocket.Session wsSession)
      • onError

        public void onError​(javax.websocket.Session wsSession,
                            Throwable throwable)
      • onMessage

        public void onMessage​(javax.websocket.Session wsSession,
                              String message)
      • prepareEventsOnOpening

        public default void prepareEventsOnOpening​(org.silverpeas.core.webapi.notification.sse.SilverpeasServerEventWebAccess.WebAccessContext wac,
                                                   Long initialLastServerEventId)