public class StompHeaders extends Object implements MultiValueMap<String,String>, Serializable
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 valueModifier and Type | Field and Description |
---|---|
static String |
ACK |
static String |
CONTENT_LENGTH |
static String |
CONTENT_TYPE |
static String |
DESTINATION |
static String |
HEARTBEAT |
static String |
HOST |
static String |
ID |
static String |
LOGIN |
static String |
MESSAGE_ID |
static String |
PASSCODE |
static String |
RECEIPT |
static String |
RECEIPT_ID |
static String |
SERVER |
static String |
SESSION |
static String |
SUBSCRIPTION |
Constructor and Description |
---|
StompHeaders()
Create a new instance to be populated with new header values.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String headerName,
String headerValue)
Add the given, single header value under the given name.
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,List<String>>> |
entrySet() |
boolean |
equals(Object other) |
List<String> |
get(Object key) |
String |
getAck()
Get the ack header.
|
long |
getContentLength()
Return the content-length header or -1 if unknown.
|
MimeType |
getContentType()
Return the content-type header value.
|
String |
getDestination()
Get the destination header.
|
String |
getFirst(String headerName)
Return the first header value for the given header name, if any.
|
long[] |
getHeartbeat()
Get the heartbeat header.
|
String |
getHost()
Get the host header.
|
String |
getId()
Get the id header.
|
String |
getLogin()
Get the login header.
|
String |
getMessageId()
Get the message-id header.
|
String |
getPasscode()
Get the passcode header.
|
String |
getReceipt()
Get the receipt header.
|
String |
getReceiptId()
Get the receipt header.
|
String |
getServer()
Get the server header.
|
String |
getSession()
Get the session header.
|
String |
getSubscription()
Get the subscription header.
|
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isHeartbeatEnabled()
Whether heartbeats are enabled.
|
Set<String> |
keySet() |
List<String> |
put(String key,
List<String> value) |
void |
putAll(Map<? extends String,? extends List<String>> map) |
static StompHeaders |
readOnlyStompHeaders(Map<String,List<String>> headers)
Return a
StompHeaders object that can only be read, not written to. |
List<String> |
remove(Object key) |
void |
set(String headerName,
String headerValue)
Set the given, single header value under the given name.
|
void |
setAck(String ack)
Set the ack header to one of "auto", "client", or "client-individual".
|
void |
setAll(Map<String,String> values)
Set the given values under.
|
void |
setContentLength(long contentLength)
Set the content-length header.
|
void |
setContentType(MimeType mimeType)
Set the content-type header.
|
void |
setDestination(String destination)
Set the destination header.
|
void |
setHeartbeat(long[] heartbeat)
Set the heartbeat header.
|
void |
setHost(String host)
Set the host header.
|
void |
setId(String id)
Set the id header.
|
void |
setLogin(String login)
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 |
setServer(String server)
Set the server header.
|
void |
setSession(String session)
Set the session header.
|
void |
setSubscription(String subscription)
Set the login header.
|
int |
size() |
Map<String,String> |
toSingleValueMap()
Return a
Map with the first values contained in this MultiValueMap . |
String |
toString() |
Collection<List<String>> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static final String CONTENT_TYPE
public static final String CONTENT_LENGTH
public static final String RECEIPT
public static final String HOST
public static final String LOGIN
public static final String PASSCODE
public static final String HEARTBEAT
public static final String SESSION
public static final String SERVER
public static final String DESTINATION
public static final String ID
public static final String ACK
public static final String SUBSCRIPTION
public static final String MESSAGE_ID
public static final String RECEIPT_ID
public StompHeaders()
public void setContentType(MimeType mimeType)
public MimeType getContentType()
public void setContentLength(long contentLength)
public long getContentLength()
public void setReceipt(String receipt)
public String getReceipt()
public void setHost(String host)
public String getHost()
public void setLogin(String login)
public String getLogin()
public void setPasscode(String passcode)
public String getPasscode()
public void setHeartbeat(long[] heartbeat)
public long[] getHeartbeat()
public boolean isHeartbeatEnabled()
false
if
setHeartbeat(long[])
is set to "0,0", and true
otherwise.public void setSession(String session)
public String getSession()
public void setServer(String server)
public String getServer()
public void setDestination(String destination)
public String getDestination()
public void setId(String id)
public String getId()
public void setAck(String ack)
public String getAck()
public void setSubscription(String subscription)
public String getSubscription()
public void setMessageId(String messageId)
public String getMessageId()
public void setReceiptId(String receiptId)
public String getReceiptId()
public String getFirst(String headerName)
getFirst
in interface MultiValueMap<String,String>
headerName
- the header namenull
if nonepublic void add(String headerName, String headerValue)
add
in interface MultiValueMap<String,String>
headerName
- the header nameheaderValue
- the header valueUnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
set(String, String)
public void set(String headerName, String headerValue)
set
in interface MultiValueMap<String,String>
headerName
- the header nameheaderValue
- the header valueUnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
add(String, String)
public void setAll(Map<String,String> values)
MultiValueMap
setAll
in interface MultiValueMap<String,String>
values
- the values.public Map<String,String> toSingleValueMap()
MultiValueMap
Map
with the first values contained in this MultiValueMap
.toSingleValueMap
in interface MultiValueMap<String,String>
public boolean containsKey(Object key)
containsKey
in interface Map<String,List<String>>
public boolean containsValue(Object value)
containsValue
in interface Map<String,List<String>>
public Collection<List<String>> values()
public boolean equals(Object other)
public int hashCode()
public static StompHeaders readOnlyStompHeaders(Map<String,List<String>> headers)
StompHeaders
object that can only be read, not written to.