Class StompHeaders
java.lang.Object
org.springframework.messaging.simp.stomp.StompHeaders
- All Implemented Interfaces:
- Serializable,- Map<String,,- List<String>> - MultiValueMap<String,- String> 
Represents STOMP frame headers.
 
In addition to the normal methods defined by Map, this class offers
 the following convenience methods:
 
- getFirst(String)return the first value for a header name
- add(String, String)add to the list of values for a header name
- set(String, String)set a header name to a single string value
- Since:
- 4.2
- Author:
- Rossen Stoyanchev
- See Also:
- 
Nested Class Summary
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance to be populated with new header values.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd the given, single header value under the given name.voidAdd all the values of the given list to the current list of values for the given key.voidaddAll(MultiValueMap<String, String> values) Add all the values of the givenMultiValueMapto the current values.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanString[]Get the accept-version header.getAck()Get the ack header.longReturn the content-length header or -1 if unknown.Return the content-type header value.Get the destination header.Return the first header value for the given header name, if any.long[]Get the heartbeat header.getHost()Get the host header.getId()Get the id header.getLogin()Get the login header.Get the message-id header.Get the passcode header.Get the receipt header.Get the receipt header.Get the server header.Get the session header.Get the subscription header.inthashCode()booleanisEmpty()booleanWhether heartbeats are enabled.keySet()voidstatic StompHeadersreadOnlyStompHeaders(Map<String, List<String>> headers) Return aStompHeadersobject that can only be read, not written to.voidSet the given, single header value under the given name.voidsetAcceptVersion(String... acceptVersions) Set the accept-version header.voidSet the ack header to one of "auto", "client", or "client-individual".voidSet the given values under.voidsetContentLength(long contentLength) Set the content-length header.voidsetContentType(MimeType mimeType) Set the content-type header.voidsetDestination(String destination) Set the destination header.voidsetHeartbeat(long[] heartbeat) Set the heartbeat header.voidSet the host header.voidSet the id header.voidSet the login header.voidsetMessageId(String messageId) Set the message-id header.voidsetPasscode(String passcode) Set the passcode header.voidsetReceipt(String receipt) Set the receipt header.voidsetReceiptId(String receiptId) Set the receipt-id header.voidSet the server header.voidsetSession(String session) Set the session header.voidsetSubscription(String subscription) Set the login header.intsize()Return aMapwith the first values contained in thisMultiValueMap.toString()values()Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface org.springframework.util.MultiValueMapaddIfAbsent, asSingleValueMap
- 
Field Details- 
CONTENT_TYPE- See Also:
 
- 
CONTENT_LENGTH- See Also:
 
- 
RECEIPT- See Also:
 
- 
HOST- See Also:
 
- 
ACCEPT_VERSION- See Also:
 
- 
LOGIN- See Also:
 
- 
PASSCODE- See Also:
 
- 
HEARTBEAT- See Also:
 
- 
SESSION- See Also:
 
- 
SERVER- See Also:
 
- 
DESTINATION- See Also:
 
- 
ID- See Also:
 
- 
ACK- See Also:
 
- 
SUBSCRIPTION- See Also:
 
- 
MESSAGE_ID- See Also:
 
- 
RECEIPT_ID- See Also:
 
 
- 
- 
Constructor Details- 
StompHeaderspublic StompHeaders()Create a new instance to be populated with new header values.
 
- 
- 
Method Details- 
setContentTypeSet the content-type header. Applies to the SEND, MESSAGE, and ERROR frames.
- 
getContentTypeReturn the content-type header value.
- 
setContentLengthpublic void setContentLength(long contentLength) Set the content-length header. Applies to the SEND, MESSAGE, and ERROR frames.
- 
getContentLengthpublic long getContentLength()Return the content-length header or -1 if unknown.
- 
setReceiptSet the receipt header. Applies to any client frame other than CONNECT.
- 
getReceiptGet the receipt header.
- 
setHostSet the host header. Applies to the CONNECT frame.
- 
getHostGet the host header.
- 
setAcceptVersionSet the accept-version header. Must be one of "1.1", "1.2", or both. Applies to the CONNECT frame.- Since:
- 5.0.7
 
- 
getAcceptVersionGet the accept-version header.- Since:
- 5.0.7
 
- 
setLoginSet the login header. Applies to the CONNECT frame.
- 
getLoginGet the login header.
- 
setPasscodeSet the passcode header. Applies to the CONNECT frame.
- 
getPasscodeGet the passcode header.
- 
setHeartbeatSet the heartbeat header. Applies to the CONNECT and CONNECTED frames.
- 
getHeartbeatGet the heartbeat header.
- 
isHeartbeatEnabledpublic boolean isHeartbeatEnabled()Whether heartbeats are enabled. ReturnsfalseifsetHeartbeat(long[])is set to "0,0", andtrueotherwise.
- 
setSessionSet the session header. Applies to the CONNECTED frame.
- 
getSessionGet the session header.
- 
setServerSet the server header. Applies to the CONNECTED frame.
- 
getServerGet the server header. Applies to the CONNECTED frame.
- 
setDestinationSet the destination header.
- 
getDestinationGet the destination header. Applies to the SEND, SUBSCRIBE, and MESSAGE frames.
- 
setIdSet the id header. Applies to the SUBSCR0BE, UNSUBSCRIBE, and ACK or NACK frames.
- 
getIdGet the id header.
- 
setAckSet the ack header to one of "auto", "client", or "client-individual". Applies to the SUBSCRIBE and MESSAGE frames.
- 
getAckGet the ack header.
- 
setSubscriptionSet the login header. Applies to the MESSAGE frame.
- 
getSubscriptionGet the subscription header.
- 
setMessageIdSet the message-id header. Applies to the MESSAGE frame.
- 
getMessageIdGet the message-id header.
- 
setReceiptIdSet the receipt-id header. Applies to the RECEIPT frame.
- 
getReceiptIdGet the receipt header.
- 
getFirstReturn the first header value for the given header name, if any.- Specified by:
- getFirstin interface- MultiValueMap<String,- String> 
- Parameters:
- headerName- the header name
- Returns:
- the first header value, or nullif none
 
- 
addAdd the given, single header value under the given name.- Specified by:
- addin interface- MultiValueMap<String,- String> 
- Parameters:
- headerName- the header name
- headerValue- the header value
- Throws:
- UnsupportedOperationException- if adding headers is not supported
- See Also:
 
- 
addAllDescription copied from interface:MultiValueMapAdd all the values of the given list to the current list of values for the given key.- Specified by:
- addAllin interface- MultiValueMap<String,- String> 
- Parameters:
- headerName- they key
- headerValues- the values to be added
 
- 
addAllDescription copied from interface:MultiValueMapAdd all the values of the givenMultiValueMapto the current values.- Specified by:
- addAllin interface- MultiValueMap<String,- String> 
- Parameters:
- values- the values to be added
 
- 
setSet the given, single header value under the given name.- Specified by:
- setin interface- MultiValueMap<String,- String> 
- Parameters:
- headerName- the header name
- headerValue- the header value
- Throws:
- UnsupportedOperationException- if adding headers is not supported
- See Also:
 
- 
setAllDescription copied from interface:MultiValueMapSet the given values under.- Specified by:
- setAllin interface- MultiValueMap<String,- String> 
- Parameters:
- values- the values.
 
- 
toSingleValueMapDescription copied from interface:MultiValueMapReturn aMapwith the first values contained in thisMultiValueMap. The difference between this method andMultiValueMap.asSingleValueMap()is that this method returns a copy of the entries of this map, whereas the latter returns a view.- Specified by:
- toSingleValueMapin interface- MultiValueMap<String,- String> 
- Returns:
- a single value representation of this map
 
- 
sizepublic int size()
- 
isEmptypublic boolean isEmpty()
- 
containsKey- Specified by:
- containsKeyin interface- Map<String,- List<String>> 
 
- 
containsValue- Specified by:
- containsValuein interface- Map<String,- List<String>> 
 
- 
get
- 
put
- 
remove
- 
putAll
- 
clearpublic void clear()
- 
keySet
- 
values
- 
entrySet
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
readOnlyStompHeadersReturn aStompHeadersobject that can only be read, not written to.
 
-