public class NativeMessageHeaderAccessor extends MessageHeaderAccessor
MessageHeaderAccessor
that also stores and provides read/write
access to message headers from an external source -- e.g. a Spring Message
created to represent a STOMP message received from a STOMP client or message broker.
Native message headers are kept in a MultiValueMap
under the key
NATIVE_HEADERS
.
This class is not intended for direct use but is rather expected to be consumed
through sub-classes such as
StompHeaderAccessor
.
Such sub-classes may provide factory methods to translate message headers from
an external messaging source (e.g. STOMP) to Spring Message
headers and
reversely to translate Spring Message
headers to a message to send to an
external source.
Modifier and Type | Field and Description |
---|---|
static String |
NATIVE_HEADERS |
logger
Modifier | Constructor and Description |
---|---|
protected |
NativeMessageHeaderAccessor(Map<String,List<String>> nativeHeaders)
A constructor for creating new headers, accepting an optional native header map.
|
protected |
NativeMessageHeaderAccessor(Message<?> message)
A constructor for accessing and modifying existing message headers.
|
Modifier and Type | Method and Description |
---|---|
void |
addNativeHeader(String name,
String value)
Add the specified native header value.
|
String |
getFirstNativeHeader(String headerName)
Return the first value for the specified native header of
null . |
List<String> |
getNativeHeader(String headerName)
Return all values for the specified native header or
null . |
boolean |
isModified() |
void |
setNativeHeader(String name,
String value)
Set the specified native header value.
|
Map<String,Object> |
toMap()
Return a header map including original, wrapped headers (if any) plus additional
header updates made through accessor methods.
|
Map<String,List<String>> |
toNativeHeaderMap()
Return a map with native headers including original, wrapped headers (if any) plus
additional header updates made through accessor methods.
|
copyHeaders, copyHeadersIfAbsent, getContentType, getErrorChannel, getHeader, getId, getReplyChannel, getTimestamp, isReadOnly, removeHeader, removeHeaders, setContentType, setErrorChannel, setErrorChannelName, setHeader, setHeaderIfAbsent, setReplyChannel, setReplyChannelName, toString, verifyType
public static final String NATIVE_HEADERS
protected NativeMessageHeaderAccessor(Map<String,List<String>> nativeHeaders)
protected NativeMessageHeaderAccessor(Message<?> message)
public Map<String,Object> toMap()
MessageHeaderAccessor
toMap
in class MessageHeaderAccessor
public boolean isModified()
isModified
in class MessageHeaderAccessor
public Map<String,List<String>> toNativeHeaderMap()
public List<String> getNativeHeader(String headerName)
null
.public String getFirstNativeHeader(String headerName)
null
.public void setNativeHeader(String name, String value)