org.springframework.web.socket.messaging

Class AbstractSubProtocolEvent

    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected AbstractSubProtocolEvent(java.lang.Object source, Message<byte[]> message)
      Create a new AbstractSubProtocolEvent.
      protected AbstractSubProtocolEvent(java.lang.Object source, Message<byte[]> message, java.security.Principal user)
      Create a new AbstractSubProtocolEvent.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Message<byte[]> getMessage()
      Return the Message associated with the event.
      java.security.Principal getUser()
      Return the user for the session associated with the event.
      java.lang.String toString() 
      • Methods inherited from class java.util.EventObject

        getSource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractSubProtocolEvent

        protected AbstractSubProtocolEvent(java.lang.Object source,
                                           Message<byte[]> message)
        Create a new AbstractSubProtocolEvent.
        Parameters:
        source - the component that published the event (never null)
        message - the incoming message (never null)
      • AbstractSubProtocolEvent

        protected AbstractSubProtocolEvent(java.lang.Object source,
                                           Message<byte[]> message,
                                           @Nullable
                                           java.security.Principal user)
        Create a new AbstractSubProtocolEvent.
        Parameters:
        source - the component that published the event (never null)
        message - the incoming message (never null)
    • Method Detail

      • getMessage

        public Message<byte[]> getMessage()
        Return the Message associated with the event. Here is an example of obtaining information about the session id or any headers in the message:
         StompHeaderAccessor headers = StompHeaderAccessor.wrap(message);
         headers.getSessionId();
         headers.getSessionAttributes();
         headers.getPrincipal();
         
      • getUser

        @Nullable
        public java.security.Principal getUser()
        Return the user for the session associated with the event.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.EventObject