public class StompHeaderAccessor extends SimpMessageHeaderAccessor
MessageHeaderAccessor
to use when creating a Message
from
a decoded STOMP frame, or when encoding a Message
to 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
NativeMessageHeaderAccessor
while the parent class SimpMessageHeaderAccessor
manages 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 generic
SimpMessageHeaderAccessor
in
which case STOMP headers are created from common processing headers.
In this case it is also necessary to invoke either
updateStompCommandAsClientMessage()
or
updateStompCommandAsServerMessage()
if sending a message and
depending on whether a message is sent to a client or the message broker.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STOMP_ACCEPT_VERSION_HEADER |
static java.lang.String |
STOMP_ACK_HEADER |
static java.lang.String |
STOMP_CONTENT_LENGTH_HEADER |
static java.lang.String |
STOMP_CONTENT_TYPE_HEADER |
static java.lang.String |
STOMP_DESTINATION_HEADER |
static java.lang.String |
STOMP_HEARTBEAT_HEADER |
static java.lang.String |
STOMP_HOST_HEADER |
static java.lang.String |
STOMP_ID_HEADER |
static java.lang.String |
STOMP_LOGIN_HEADER |
static java.lang.String |
STOMP_MESSAGE_HEADER |
static java.lang.String |
STOMP_MESSAGE_ID_HEADER |
static java.lang.String |
STOMP_NACK_HEADER |
static java.lang.String |
STOMP_PASSCODE_HEADER |
static java.lang.String |
STOMP_RECEIPT_HEADER |
static java.lang.String |
STOMP_RECEIPT_ID_HEADER |
static java.lang.String |
STOMP_SUBSCRIPTION_HEADER |
static java.lang.String |
STOMP_VERSION_HEADER |
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
NATIVE_HEADERS
DEFAULT_CHARSET
Modifier and Type | Method and Description |
---|---|
static StompHeaderAccessor |
create(StompCommand command)
Create an instance for the given STOMP command.
|
static StompHeaderAccessor |
create(StompCommand command,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
Create an instance for the given STOMP command and headers.
|
protected MessageHeaderAccessor |
createAccessor(Message<?> message)
Build a 'nested' accessor for the given message.
|
static StompHeaderAccessor |
createForHeartbeat()
Create headers for a heartbeat.
|
java.util.Set<java.lang.String> |
getAcceptVersion() |
java.lang.String |
getAck() |
StompCommand |
getCommand()
Return the STOMP command, or
null if not yet set. |
static StompCommand |
getCommand(java.util.Map<java.lang.String,java.lang.Object> headers)
Return the STOMP command from the given headers, or
null if not set. |
java.lang.Integer |
getContentLength() |
static java.lang.Integer |
getContentLength(java.util.Map<java.lang.String,java.util.List<java.lang.String>> nativeHeaders) |
java.lang.String |
getDetailedLogMessage(java.lang.Object payload)
Return a more detailed message for logging purposes.
|
long[] |
getHeartbeat() |
java.lang.String |
getHost() |
java.lang.String |
getLogin() |
java.lang.String |
getMessage() |
java.lang.String |
getMessageId() |
java.lang.String |
getNack() |
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getNativeHeaders() |
java.lang.String |
getPasscode()
Return the passcode header value, or
null if not set. |
static java.lang.String |
getPasscode(java.util.Map<java.lang.String,java.lang.Object> headers)
Return the passcode header value, or
null if not set. |
java.lang.String |
getReceipt() |
java.lang.String |
getReceiptId() |
java.lang.String |
getShortLogMessage(java.lang.Object payload)
Return a concise message for logging purposes.
|
java.lang.String |
getVersion() |
boolean |
isHeartbeat() |
void |
setAcceptVersion(java.lang.String acceptVersion) |
void |
setAck(java.lang.String ack) |
void |
setContentLength(int contentLength) |
void |
setContentType(MimeType contentType) |
void |
setDestination(java.lang.String destination) |
void |
setHeartbeat(long cx,
long cy) |
void |
setHost(java.lang.String host) |
void |
setLogin(java.lang.String login) |
void |
setMessage(java.lang.String content) |
void |
setMessageId(java.lang.String id) |
void |
setNack(java.lang.String nack) |
void |
setPasscode(java.lang.String passcode) |
void |
setReceipt(java.lang.String receiptId) |
void |
setReceiptId(java.lang.String receiptId) |
void |
setSubscriptionId(java.lang.String subscriptionId) |
void |
setVersion(java.lang.String version) |
StompCommand |
updateStompCommandAsClientMessage() |
void |
updateStompCommandAsServerMessage() |
static StompHeaderAccessor |
wrap(Message<?> message)
Create an instance from the payload and headers of the given Message.
|
create, create, getDestination, getDestination, getHeartbeat, getMessageType, getMessageType, getSessionAttributes, getSessionAttributes, getSessionId, getSessionId, getSubscriptionId, getSubscriptionId, getUser, getUser, setMessageTypeIfNotSet, setSessionAttributes, setSessionId, setUser
addNativeHeader, addNativeHeaders, containsNativeHeader, getFirstNativeHeader, getFirstNativeHeader, getNativeHeader, removeNativeHeader, setImmutable, setNativeHeader, toNativeHeaderMap
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
public static final java.lang.String STOMP_ID_HEADER
public static final java.lang.String STOMP_HOST_HEADER
public static final java.lang.String STOMP_ACCEPT_VERSION_HEADER
public static final java.lang.String STOMP_MESSAGE_ID_HEADER
public static final java.lang.String STOMP_RECEIPT_HEADER
public static final java.lang.String STOMP_RECEIPT_ID_HEADER
public static final java.lang.String STOMP_SUBSCRIPTION_HEADER
public static final java.lang.String STOMP_VERSION_HEADER
public static final java.lang.String STOMP_MESSAGE_HEADER
public static final java.lang.String STOMP_ACK_HEADER
public static final java.lang.String STOMP_NACK_HEADER
public static final java.lang.String STOMP_LOGIN_HEADER
public static final java.lang.String STOMP_PASSCODE_HEADER
public static final java.lang.String STOMP_DESTINATION_HEADER
public static final java.lang.String STOMP_CONTENT_TYPE_HEADER
public static final java.lang.String STOMP_CONTENT_LENGTH_HEADER
public static final java.lang.String STOMP_HEARTBEAT_HEADER
protected MessageHeaderAccessor createAccessor(Message<?> message)
MessageHeaderAccessor
createAccessor
in class SimpMessageHeaderAccessor
message
- the message to build a new accessor for@Nullable protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> getNativeHeaders()
getNativeHeaders
in class NativeMessageHeaderAccessor
public StompCommand updateStompCommandAsClientMessage()
public void updateStompCommandAsServerMessage()
@Nullable public StompCommand getCommand()
null
if not yet set.public boolean isHeartbeat()
public long[] getHeartbeat()
public void setAcceptVersion(java.lang.String acceptVersion)
public java.util.Set<java.lang.String> getAcceptVersion()
public void setHost(@Nullable java.lang.String host)
@Nullable public java.lang.String getHost()
public void setDestination(@Nullable java.lang.String destination)
setDestination
in class SimpMessageHeaderAccessor
public void setContentType(MimeType contentType)
setContentType
in class MessageHeaderAccessor
public void setSubscriptionId(@Nullable java.lang.String subscriptionId)
setSubscriptionId
in class SimpMessageHeaderAccessor
@Nullable public java.lang.Integer getContentLength()
public void setContentLength(int contentLength)
public void setHeartbeat(long cx, long cy)
public void setAck(@Nullable java.lang.String ack)
@Nullable public java.lang.String getAck()
public void setNack(@Nullable java.lang.String nack)
@Nullable public java.lang.String getNack()
public void setLogin(@Nullable java.lang.String login)
@Nullable public java.lang.String getLogin()
public void setPasscode(@Nullable java.lang.String passcode)
@Nullable public java.lang.String getPasscode()
null
if not set.public void setReceiptId(@Nullable java.lang.String receiptId)
@Nullable public java.lang.String getReceiptId()
public void setReceipt(@Nullable java.lang.String receiptId)
@Nullable public java.lang.String getReceipt()
@Nullable public java.lang.String getMessage()
public void setMessage(@Nullable java.lang.String content)
@Nullable public java.lang.String getMessageId()
public void setMessageId(@Nullable java.lang.String id)
@Nullable public java.lang.String getVersion()
public void setVersion(@Nullable java.lang.String version)
public java.lang.String getShortLogMessage(java.lang.Object payload)
MessageHeaderAccessor
getShortLogMessage
in class SimpMessageHeaderAccessor
payload
- the payload that corresponds to the headers.public java.lang.String getDetailedLogMessage(@Nullable java.lang.Object payload)
MessageHeaderAccessor
getDetailedLogMessage
in class SimpMessageHeaderAccessor
payload
- the payload that corresponds to the headers.public static StompHeaderAccessor create(StompCommand command)
public static StompHeaderAccessor create(StompCommand command, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
public static StompHeaderAccessor createForHeartbeat()
public static StompHeaderAccessor wrap(Message<?> message)
@Nullable public static StompCommand getCommand(java.util.Map<java.lang.String,java.lang.Object> headers)
null
if not set.@Nullable public static java.lang.String getPasscode(java.util.Map<java.lang.String,java.lang.Object> headers)
null
if not set.@Nullable public static java.lang.Integer getContentLength(java.util.Map<java.lang.String,java.util.List<java.lang.String>> nativeHeaders)