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 nameadd(String, String)add to the list of values for a header nameset(String, String)set a header name to a single string value
- Since:
- 4.2
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier 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 Summary
ConstructorsConstructorDescriptionCreate a new instance to be populated with new header values. -
Method Summary
Modifier 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()booleanGet 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 @Nullable []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 StompHeadersReturn aStompHeadersobject that can only be read, not written to.voidSet the given, single header value under the given name.voidsetAcceptVersion(String @Nullable ... 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(@Nullable MimeType mimeType) Set the content-type header.voidsetDestination(@Nullable String destination) Set the destination header.voidsetHeartbeat(long @Nullable [] heartbeat) Set the heartbeat header.voidSet the host header.voidSet the id header.voidSet the login header.voidsetMessageId(@Nullable String messageId) Set the message-id header.voidsetPasscode(@Nullable String passcode) Set the passcode header.voidsetReceipt(@Nullable String receipt) Set the receipt header.voidsetReceiptId(@Nullable String receiptId) Set the receipt-id header.voidSet the server header.voidsetSession(@Nullable String session) Set the session header.voidsetSubscription(@Nullable String subscription) Set the login header.intsize()Return aMapwith the first values contained in thisMultiValueMap.toString()values()Methods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface MultiValueMap
addIfAbsent, 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
-
StompHeaders
public StompHeaders()Create a new instance to be populated with new header values.
-
-
Method Details
-
setContentType
-
getContentType
-
setContentLength
public void setContentLength(long contentLength) Set the content-length header. Applies to the SEND, MESSAGE, and ERROR frames. -
getContentLength
public long getContentLength()Return the content-length header or -1 if unknown. -
setReceipt
-
getReceipt
-
setHost
-
getHost
-
setAcceptVersion
-
getAcceptVersion
-
setLogin
-
getLogin
-
setPasscode
-
getPasscode
-
setHeartbeat
Set the heartbeat header. Applies to the CONNECT and CONNECTED frames. -
getHeartbeat
Get the heartbeat header. -
isHeartbeatEnabled
public boolean isHeartbeatEnabled()Whether heartbeats are enabled. ReturnsfalseifsetHeartbeat(long[])is set to "0,0", andtrueotherwise. -
setSession
-
getSession
-
setServer
-
getServer
-
setDestination
-
getDestination
-
setId
-
getId
-
setAck
-
getAck
-
setSubscription
-
getSubscription
-
setMessageId
-
getMessageId
-
setReceiptId
-
getReceiptId
-
getFirst
-
add
Add the given, single header value under the given name.- Specified by:
addin interfaceMultiValueMap<String,String> - Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
-
addAll
Description copied from interface:MultiValueMapAdd all the values of the given list to the current list of values for the given key.- Specified by:
addAllin interfaceMultiValueMap<String,String> - Parameters:
headerName- they keyheaderValues- the values to be added
-
addAll
Description copied from interface:MultiValueMapAdd all the values of the givenMultiValueMapto the current values.- Specified by:
addAllin interfaceMultiValueMap<String,String> - Parameters:
values- the values to be added
-
set
Set the given, single header value under the given name.- Specified by:
setin interfaceMultiValueMap<String,String> - Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
-
setAll
Description copied from interface:MultiValueMapSet the given values under.- Specified by:
setAllin interfaceMultiValueMap<String,String> - Parameters:
values- the values.
-
toSingleValueMap
Description 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 interfaceMultiValueMap<String,String> - Returns:
- a single value representation of this map
-
size
-
isEmpty
-
containsKey
-
containsValue
-
get
-
put
-
remove
-
putAll
-
clear
-
keySet
-
values
-
entrySet
-
equals
-
hashCode
-
toString
-
readOnlyStompHeaders
-