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 String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance to be populated with new header values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given, single header value under the given name.void
Add all the values of the given list to the current list of values for the given key.void
addAll
(MultiValueMap<String, String> values) Add all the values of the givenMultiValueMap
to the current values.void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
Get the accept-version header.getAck()
Get the ack header.long
Return 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.int
hashCode()
boolean
isEmpty()
boolean
Whether heartbeats are enabled.keySet()
void
static StompHeaders
Return aStompHeaders
object that can only be read, not written to.void
Set the given, single header value under the given name.void
setAcceptVersion
(String @Nullable ... acceptVersions) Set the accept-version header.void
Set the ack header to one of "auto", "client", or "client-individual".void
Set the given values under.void
setContentLength
(long contentLength) Set the content-length header.void
setContentType
(@Nullable MimeType mimeType) Set the content-type header.void
setDestination
(@Nullable String destination) Set the destination header.void
setHeartbeat
(long @Nullable [] heartbeat) Set the heartbeat header.void
Set the host header.void
Set the id header.void
Set the login header.void
setMessageId
(@Nullable String messageId) Set the message-id header.void
setPasscode
(@Nullable String passcode) Set the passcode header.void
setReceipt
(@Nullable String receipt) Set the receipt header.void
setReceiptId
(@Nullable String receiptId) Set the receipt-id header.void
Set the server header.void
setSession
(@Nullable String session) Set the session header.void
setSubscription
(@Nullable String subscription) Set the login header.int
size()
Return aMap
with the first values contained in thisMultiValueMap
.toString()
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
Methods inherited from interface org.springframework.util.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. Returnsfalse
ifsetHeartbeat(long[])
is set to "0,0", andtrue
otherwise. -
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:
add
in 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:MultiValueMap
Add all the values of the given list to the current list of values for the given key.- Specified by:
addAll
in interfaceMultiValueMap<String,
String> - Parameters:
headerName
- they keyheaderValues
- the values to be added
-
addAll
Description copied from interface:MultiValueMap
Add all the values of the givenMultiValueMap
to the current values.- Specified by:
addAll
in interfaceMultiValueMap<String,
String> - Parameters:
values
- the values to be added
-
set
Set the given, single header value under the given name.- Specified by:
set
in 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:MultiValueMap
Set the given values under.- Specified by:
setAll
in interfaceMultiValueMap<String,
String> - Parameters:
values
- the values.
-
toSingleValueMap
Description copied from interface:MultiValueMap
Return aMap
with 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:
toSingleValueMap
in 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
-