Class StompHeaders
java.lang.Object
org.springframework.messaging.simp.stomp.StompHeaders
- All Implemented Interfaces:
Serializable
,Map<String,
,List<String>> org.springframework.util.MultiValueMap<String,
String>
public class StompHeaders
extends Object
implements org.springframework.util.MultiValueMap<String,String>, Serializable
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
Modifier 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
ConstructorDescriptionCreate 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
void
void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
String[]
Get the accept-version header.getAck()
Get the ack header.long
Return the content-length header or -1 if unknown.org.springframework.util.MimeType
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.int
hashCode()
boolean
isEmpty()
boolean
Whether heartbeats are enabled.keySet()
void
static StompHeaders
readOnlyStompHeaders
(Map<String, List<String>> headers) 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... acceptVersions) Set the accept-version header.void
Set the ack header to one of "auto", "client", or "client-individual".void
void
setContentLength
(long contentLength) Set the content-length header.void
setContentType
(org.springframework.util.MimeType mimeType) Set the content-type header.void
setDestination
(String destination) Set the destination header.void
setHeartbeat
(long[] heartbeat) Set the heartbeat header.void
Set the host header.void
Set the id header.void
Set the login header.void
setMessageId
(String messageId) Set the message-id header.void
setPasscode
(String passcode) Set the passcode header.void
setReceipt
(String receipt) Set the receipt header.void
setReceiptId
(String receiptId) Set the receipt-id header.void
Set the server header.void
setSession
(String session) Set the session header.void
setSubscription
(String subscription) Set the login header.int
size()
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
-
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
public void setContentType(@Nullable org.springframework.util.MimeType mimeType) Set the content-type header. Applies to the SEND, MESSAGE, and ERROR frames. -
getContentType
@Nullable public org.springframework.util.MimeType 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
public void setHeartbeat(@Nullable long[] heartbeat) Set the heartbeat header. Applies to the CONNECT and CONNECTED frames. -
getHeartbeat
@Nullable public long[] getHeartbeat()Get the heartbeat header. -
isHeartbeatEnabled
public boolean isHeartbeatEnabled()Whether heartbeats are enabled. Returnsfalse
ifsetHeartbeat(long[])
is set to "0,0", andtrue
otherwise. -
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. -
add
Add the given, single header value under the given name.- Specified by:
add
in interfaceorg.springframework.util.MultiValueMap<String,
String> - Parameters:
headerName
- the header nameheaderValue
- the header value- Throws:
UnsupportedOperationException
- if adding headers is not supported- See Also:
-
addAll
-
addAll
-
set
Set the given, single header value under the given name.- Specified by:
set
in interfaceorg.springframework.util.MultiValueMap<String,
String> - Parameters:
headerName
- the header nameheaderValue
- the header value- Throws:
UnsupportedOperationException
- if adding headers is not supported- See Also:
-
setAll
-
toSingleValueMap
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<String,
List<String>>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
List<String>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode() -
toString
-
readOnlyStompHeaders
Return aStompHeaders
object that can only be read, not written to.
-