类 StompHeaderAccessor
- java.lang.Object
- org.springframework.messaging.support.MessageHeaderAccessor
- org.springframework.messaging.support.NativeMessageHeaderAccessor
- org.springframework.messaging.simp.SimpMessageHeaderAccessor
- org.springframework.messaging.simp.stomp.StompHeaderAccessor
public class StompHeaderAccessor extends SimpMessageHeaderAccessor
AMessageHeaderAccessorto use when creating aMessagefrom a decoded STOMP frame, or when encoding aMessageto a STOMP frame.When created from STOMP frame content, the actual STOMP headers are stored in the native header sub-map managed by the parent class
NativeMessageHeaderAccessorwhile the parent classSimpMessageHeaderAccessormanages common processing headers some of which are based on STOMP headers (e.g. destination, content-type, etc).An instance of this class can also be created by wrapping an existing
Message. That message may have been created with the more genericSimpMessageHeaderAccessorin which case STOMP headers are created from common processing headers. In this case it is also necessary to invoke eitherupdateStompCommandAsClientMessage()orupdateStompCommandAsServerMessage()if sending a message and depending on whether a message is sent to a client or the message broker.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 static StringSTOMP_ACCEPT_VERSION_HEADERstatic StringSTOMP_ACK_HEADERstatic StringSTOMP_CONTENT_LENGTH_HEADERstatic StringSTOMP_CONTENT_TYPE_HEADERstatic StringSTOMP_DESTINATION_HEADERstatic StringSTOMP_HEARTBEAT_HEADERstatic StringSTOMP_HOST_HEADERstatic StringSTOMP_ID_HEADERstatic StringSTOMP_LOGIN_HEADERstatic StringSTOMP_MESSAGE_HEADERstatic StringSTOMP_MESSAGE_ID_HEADERstatic StringSTOMP_NACK_HEADERstatic StringSTOMP_PASSCODE_HEADERstatic StringSTOMP_RECEIPT_HEADERstatic StringSTOMP_RECEIPT_ID_HEADERstatic StringSTOMP_SUBSCRIPTION_HEADERstatic StringSTOMP_VERSION_HEADER从类继承的字段 org.springframework.messaging.simp.SimpMessageHeaderAccessor
CONNECT_MESSAGE_HEADER, DESTINATION_HEADER, DISCONNECT_MESSAGE_HEADER, HEART_BEAT_HEADER, IGNORE_ERROR, MESSAGE_TYPE_HEADER, ORIGINAL_DESTINATION, SESSION_ATTRIBUTES, SESSION_ID_HEADER, SUBSCRIPTION_ID_HEADER, USER_HEADER
从类继承的字段 org.springframework.messaging.support.NativeMessageHeaderAccessor
NATIVE_HEADERS
从类继承的字段 org.springframework.messaging.support.MessageHeaderAccessor
DEFAULT_CHARSET
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static StompHeaderAccessorcreate(StompCommand command)Create an instance for the given STOMP command.static StompHeaderAccessorcreate(StompCommand command, Map<String,List<String>> headers)Create an instance for the given STOMP command and headers.protected MessageHeaderAccessorcreateAccessor(Message<?> message)Build a 'nested' accessor for the given message.static StompHeaderAccessorcreateForHeartbeat()Create headers for a heartbeat.Set<String>getAcceptVersion()StringgetAck()StompCommandgetCommand()Return the STOMP command, ornullif not yet set.static StompCommandgetCommand(Map<String,Object> headers)Return the STOMP command from the given headers, ornullif not set.IntegergetContentLength()static IntegergetContentLength(Map<String,List<String>> nativeHeaders)StringgetDetailedLogMessage(Object payload)Return a more detailed message for logging purposes.long[]getHeartbeat()StringgetHost()StringgetLogin()StringgetMessage()StringgetMessageId()StringgetNack()StringgetPasscode()Return the passcode header value, ornullif not set.static StringgetPasscode(Map<String,Object> headers)Return the passcode header value, ornullif not set.StringgetReceipt()StringgetReceiptId()StringgetShortLogMessage(Object payload)Return a concise message for logging purposes.StringgetVersion()booleanisHeartbeat()voidsetAcceptVersion(String acceptVersion)voidsetAck(String ack)voidsetContentLength(int contentLength)voidsetContentType(MimeType contentType)voidsetDestination(String destination)voidsetHeartbeat(long cx, long cy)voidsetHost(String host)voidsetLogin(String login)voidsetMessage(String content)voidsetMessageId(String id)voidsetNack(String nack)voidsetPasscode(String passcode)voidsetReceipt(String receiptId)voidsetReceiptId(String receiptId)voidsetSubscriptionId(String subscriptionId)voidsetVersion(String version)StompCommandupdateStompCommandAsClientMessage()voidupdateStompCommandAsServerMessage()static StompHeaderAccessorwrap(Message<?> message)Create an instance from the payload and headers of the given Message.从类继承的方法 org.springframework.messaging.simp.SimpMessageHeaderAccessor
create, create, getDestination, getDestination, getHeartbeat, getMessageType, getMessageType, getSessionAttributes, getSessionAttributes, getSessionId, getSessionId, getSubscriptionId, getSubscriptionId, getUser, getUser, setMessageTypeIfNotSet, setSessionAttributes, setSessionId, setUser
从类继承的方法 org.springframework.messaging.support.NativeMessageHeaderAccessor
addNativeHeader, addNativeHeaders, containsNativeHeader, getFirstNativeHeader, getFirstNativeHeader, getNativeHeader, removeNativeHeader, setImmutable, setNativeHeader, toNativeHeaderMap
从类继承的方法 org.springframework.messaging.support.MessageHeaderAccessor
copyHeaders, copyHeadersIfAbsent, getAccessor, getAccessor, getContentType, getDetailedPayloadLogMessage, getErrorChannel, getHeader, getId, getMessageHeaders, getMutableAccessor, getReplyChannel, getShortPayloadLogMessage, getTimestamp, isModified, isMutable, isReadableContentType, isReadOnly, removeHeader, removeHeaders, setErrorChannel, setErrorChannelName, setHeader, setHeaderIfAbsent, setLeaveMutable, setModified, setReplyChannel, setReplyChannelName, toMap, toMessageHeaders, toString, verifyType
字段详细资料
STOMP_ID_HEADER
public static final String STOMP_ID_HEADER
- 另请参阅:
- 常量字段值
STOMP_HOST_HEADER
public static final String STOMP_HOST_HEADER
- 另请参阅:
- 常量字段值
STOMP_ACCEPT_VERSION_HEADER
public static final String STOMP_ACCEPT_VERSION_HEADER
- 另请参阅:
- 常量字段值
STOMP_MESSAGE_ID_HEADER
public static final String STOMP_MESSAGE_ID_HEADER
- 另请参阅:
- 常量字段值
STOMP_RECEIPT_HEADER
public static final String STOMP_RECEIPT_HEADER
- 另请参阅:
- 常量字段值
STOMP_RECEIPT_ID_HEADER
public static final String STOMP_RECEIPT_ID_HEADER
- 另请参阅:
- 常量字段值
STOMP_SUBSCRIPTION_HEADER
public static final String STOMP_SUBSCRIPTION_HEADER
- 另请参阅:
- 常量字段值
STOMP_VERSION_HEADER
public static final String STOMP_VERSION_HEADER
- 另请参阅:
- 常量字段值
STOMP_MESSAGE_HEADER
public static final String STOMP_MESSAGE_HEADER
- 另请参阅:
- 常量字段值
STOMP_ACK_HEADER
public static final String STOMP_ACK_HEADER
- 另请参阅:
- 常量字段值
STOMP_NACK_HEADER
public static final String STOMP_NACK_HEADER
- 另请参阅:
- 常量字段值
STOMP_LOGIN_HEADER
public static final String STOMP_LOGIN_HEADER
- 另请参阅:
- 常量字段值
STOMP_PASSCODE_HEADER
public static final String STOMP_PASSCODE_HEADER
- 另请参阅:
- 常量字段值
STOMP_DESTINATION_HEADER
public static final String STOMP_DESTINATION_HEADER
- 另请参阅:
- 常量字段值
STOMP_CONTENT_TYPE_HEADER
public static final String STOMP_CONTENT_TYPE_HEADER
- 另请参阅:
- 常量字段值
STOMP_CONTENT_LENGTH_HEADER
public static final String STOMP_CONTENT_LENGTH_HEADER
- 另请参阅:
- 常量字段值
STOMP_HEARTBEAT_HEADER
public static final String STOMP_HEARTBEAT_HEADER
- 另请参阅:
- 常量字段值
方法详细资料
createAccessor
protected MessageHeaderAccessor createAccessor(Message<?> message)
从类复制的说明:MessageHeaderAccessorBuild a 'nested' accessor for the given message.- 覆盖:
createAccessor在类中SimpMessageHeaderAccessor- 参数:
message- the message to build a new accessor for- 返回:
- the nested accessor (typically a specific subclass)
updateStompCommandAsClientMessage
public StompCommand updateStompCommandAsClientMessage()
updateStompCommandAsServerMessage
public void updateStompCommandAsServerMessage()
getCommand
public StompCommand getCommand()
Return the STOMP command, ornullif not yet set.
isHeartbeat
public boolean isHeartbeat()
getHeartbeat
public long[] getHeartbeat()
setAcceptVersion
public void setAcceptVersion(String acceptVersion)
getAcceptVersion
public Set<String> getAcceptVersion()
setDestination
public void setDestination(String destination)
setContentType
public void setContentType(MimeType contentType)
setSubscriptionId
public void setSubscriptionId(String subscriptionId)
getContentLength
public Integer getContentLength()
setContentLength
public void setContentLength(int contentLength)
setHeartbeat
public void setHeartbeat(long cx, long cy)
setPasscode
public void setPasscode(String passcode)
getPasscode
public String getPasscode()
Return the passcode header value, ornullif not set.
setReceiptId
public void setReceiptId(String receiptId)
getReceiptId
public String getReceiptId()
setReceipt
public void setReceipt(String receiptId)
getReceipt
public String getReceipt()
getMessage
public String getMessage()
setMessage
public void setMessage(String content)
getMessageId
public String getMessageId()
setMessageId
public void setMessageId(String id)
getVersion
public String getVersion()
setVersion
public void setVersion(String version)
getShortLogMessage
public String getShortLogMessage(Object payload)
从类复制的说明:MessageHeaderAccessorReturn a concise message for logging purposes.- 覆盖:
getShortLogMessage在类中SimpMessageHeaderAccessor- 参数:
payload- the payload that corresponds to the headers.- 返回:
- the message
getDetailedLogMessage
public String getDetailedLogMessage(Object payload)
从类复制的说明:MessageHeaderAccessorReturn a more detailed message for logging purposes.- 覆盖:
getDetailedLogMessage在类中SimpMessageHeaderAccessor- 参数:
payload- the payload that corresponds to the headers.- 返回:
- the message
create
public static StompHeaderAccessor create(StompCommand command)
Create an instance for the given STOMP command.
create
public static StompHeaderAccessor create(StompCommand command, Map<String,List<String>> headers)
Create an instance for the given STOMP command and headers.
createForHeartbeat
public static StompHeaderAccessor createForHeartbeat()
Create headers for a heartbeat. While a STOMP heartbeat frame does not have headers, a session id is needed for processing purposes at a minimum.
wrap
public static StompHeaderAccessor wrap(Message<?> message)
Create an instance from the payload and headers of the given Message.
getCommand
public static StompCommand getCommand(Map<String,Object> headers)
Return the STOMP command from the given headers, ornullif not set.
getPasscode
public static String getPasscode(Map<String,Object> headers)
Return the passcode header value, ornullif not set.