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()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.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface org.springframework.util.MultiValueMap
addIfAbsent
-
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
Set the content-type header. Applies to the SEND, MESSAGE, and ERROR frames. -
getContentType
Return the content-type header value. -
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
Set the receipt header. Applies to any client frame other than CONNECT. -
getReceipt
Get the receipt header. -
setHost
Set the host header. Applies to the CONNECT frame. -
getHost
Get the host header. -
setAcceptVersion
Set the accept-version header. Must be one of "1.1", "1.2", or both. Applies to the CONNECT frame.- Since:
- 5.0.7
-
getAcceptVersion
Get the accept-version header.- Since:
- 5.0.7
-
setLogin
Set the login header. Applies to the CONNECT frame. -
getLogin
Get the login header. -
setPasscode
Set the passcode header. Applies to the CONNECT frame. -
getPasscode
Get the passcode header. -
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
Set the session header. Applies to the CONNECTED frame. -
getSession
Get the session header. -
setServer
Set the server header. Applies to the CONNECTED frame. -
getServer
Get the server header. Applies to the CONNECTED frame. -
setDestination
Set the destination header. -
getDestination
Get the destination header. Applies to the SEND, SUBSCRIBE, and MESSAGE frames. -
setId
Set the id header. Applies to the SUBSCR0BE, UNSUBSCRIBE, and ACK or NACK frames. -
getId
Get the id header. -
setAck
Set the ack header to one of "auto", "client", or "client-individual". Applies to the SUBSCRIBE and MESSAGE frames. -
getAck
Get the ack header. -
setSubscription
Set the login header. Applies to the MESSAGE frame. -
getSubscription
Get the subscription header. -
setMessageId
Set the message-id header. Applies to the MESSAGE frame. -
getMessageId
Get the message-id header. -
setReceiptId
Set the receipt-id header. Applies to the RECEIPT frame. -
getReceiptId
Get the receipt header. -
getFirst
Return the first header value for the given header name, if any.- Specified by:
getFirstin interfaceMultiValueMap<String,String> - Parameters:
headerName- the header name- Returns:
- the first header value, or
nullif none
-
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.- Specified by:
toSingleValueMapin interfaceMultiValueMap<String,String> - Returns:
- a single value representation of this map
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode() -
toString
-
readOnlyStompHeaders
Return aStompHeadersobject that can only be read, not written to.
-