类 AbstractSubProtocolEvent
- java.lang.Object
- java.util.EventObject
- org.springframework.context.ApplicationEvent
- org.springframework.web.socket.messaging.AbstractSubProtocolEvent
- 所有已实现的接口:
Serializable
- 直接已知子类:
SessionConnectedEvent
,SessionConnectEvent
,SessionDisconnectEvent
,SessionSubscribeEvent
,SessionUnsubscribeEvent
public abstract class AbstractSubProtocolEvent extends ApplicationEvent
A base class for events for a message received from a WebSocket client and parsed into a higher-level sub-protocol (e.g. STOMP).- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
字段概要
从类继承的字段 java.util.EventObject
source
构造器概要
构造器 限定符 构造器 说明 protected
AbstractSubProtocolEvent(Object source, Message<byte[]> message)
Create a new AbstractSubProtocolEvent.protected
AbstractSubProtocolEvent(Object source, Message<byte[]> message, Principal user)
Create a new AbstractSubProtocolEvent.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Message<byte[]>
getMessage()
Return the Message associated with the event.Principal
getUser()
Return the user for the session associated with the event.String
toString()
从类继承的方法 org.springframework.context.ApplicationEvent
getTimestamp
从类继承的方法 java.util.EventObject
getSource
构造器详细资料
AbstractSubProtocolEvent
protected AbstractSubProtocolEvent(Object source, Message<byte[]> message)
Create a new AbstractSubProtocolEvent.- 参数:
source
- the component that published the event (nevernull
)message
- the incoming message (nevernull
)
AbstractSubProtocolEvent
protected AbstractSubProtocolEvent(Object source, Message<byte[]> message, @Nullable Principal user)
Create a new AbstractSubProtocolEvent.- 参数:
source
- the component that published the event (nevernull
)message
- the incoming message (nevernull
)
方法详细资料
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 Principal getUser()
Return the user for the session associated with the event.
toString
public String toString()
- 覆盖:
toString
在类中EventObject