Class SilverpeasWebSocketContext

    • Method Detail

      • wrap

        public static SilverpeasWebSocketContext wrap​(javax.websocket.Session session,
                                                      String userSessionId,
                                                      User user)
        Wraps the given instance. Nothing is wrapped if the given instance is a wrapped one.
        Parameters:
        session - the instance to wrap.
        userSessionId - the identifier or the user session.
        user - the identifier of th user linked to the async request.
        Returns:
        the wrapped given instance.
      • getRequestURI

        public String getRequestURI()
        Gets the request URI behind the async context.
        Returns:
        a request URI as string.
      • isSendPossible

        public boolean isSendPossible()
        Description copied from interface: SilverpeasServerEventContext
        Indicates if the sending is yet possible.
        Returns:
        true if possible, false otherwise.
      • hashCode

        public int hashCode()
      • equals

        public boolean equals​(Object obj)
      • getSessionId

        public String getSessionId()
        Description copied from interface: SilverpeasServerEventContext
        Gets the session identifier linked to the context.

        Be careful, according to the WEB context, the session identifier is not necessarily the JSESSIONID.

        Specified by:
        getSessionId in interface SilverpeasServerEventContext
        Returns:
        a session identifier as string.
      • setLastServerEventId

        public void setLastServerEventId​(Long lastServerEventId)
        Sets the last server event identifier.
        Specified by:
        setLastServerEventId in interface SilverpeasServerEventContext
        Parameters:
        lastServerEventId - a last event identifier as long, can be null.
      • getWrappedInstance

        protected W getWrappedInstance()
      • sendEvent

        public boolean sendEvent​(String name,
                                 long id,
                                 String data)
                          throws IOException
        Description copied from interface: SilverpeasServerEventContext
        Sends the given using elements of the context.

        If sending has not been done, then context is removed from the context manager.

        Specified by:
        sendEvent in interface SilverpeasServerEventContext
        Parameters:
        name - the name of the event.
        id - the unique identifier of the event (from the start of the server).
        data - the data sent with the event.
        Returns:
        true if send has been done, false otherwise.
        Throws:
        IOException