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 |
ACCEPT_VERSION |
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 |
addAll(MultiValueMap<String,String> values)
Add all the values of the given
MultiValueMap to the current values. |
void |
addAll(String headerName,
List<? extends String> headerValues)
Add all the values of the given list to the current list of values for the given key.
|
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[] |
getAcceptVersion()
Get the accept-version header.
|
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 |
setAcceptVersion(String... acceptVersions)
Set the accept-version header.
|
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
addIfAbsent
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 ACCEPT_VERSION
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(@Nullable MimeType mimeType)
public void setContentLength(long contentLength)
public long getContentLength()
public void setReceipt(@Nullable String receipt)
public void setHost(@Nullable String host)
public void setAcceptVersion(@Nullable String... acceptVersions)
@Nullable public String[] getAcceptVersion()
public void setLogin(@Nullable String login)
public void setPasscode(@Nullable String passcode)
public void setHeartbeat(@Nullable long[] heartbeat)
@Nullable public long[] getHeartbeat()
public boolean isHeartbeatEnabled()
false
if
setHeartbeat(long[])
is set to "0,0", and true
otherwise.public void setSession(@Nullable String session)
public void setServer(@Nullable String server)
@Nullable public String getServer()
@Nullable public String getDestination()
public void setId(@Nullable String id)
public void setAck(@Nullable String ack)
public void setSubscription(@Nullable String subscription)
public void setMessageId(@Nullable String messageId)
public void setReceiptId(@Nullable String receiptId)
@Nullable public String getFirst(String headerName)
getFirst
in interface MultiValueMap<String,String>
headerName
- the header namenull
if nonepublic void add(String headerName, @Nullable 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 addAll(String headerName, List<? extends String> headerValues)
MultiValueMap
addAll
in interface MultiValueMap<String,String>
headerName
- they keyheaderValues
- the values to be addedpublic void addAll(MultiValueMap<String,String> values)
MultiValueMap
MultiValueMap
to the current values.addAll
in interface MultiValueMap<String,String>
values
- the values to be addedpublic void set(String headerName, @Nullable 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 int hashCode()