public class StompHeaders extends java.lang.Object implements MultiValueMap<java.lang.String,java.lang.String>, java.io.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 java.lang.String |
ACK |
static java.lang.String |
CONTENT_LENGTH |
static java.lang.String |
CONTENT_TYPE |
static java.lang.String |
DESTINATION |
static java.lang.String |
HEARTBEAT |
static java.lang.String |
HOST |
static java.lang.String |
ID |
static java.lang.String |
LOGIN |
static java.lang.String |
MESSAGE_ID |
static java.lang.String |
PASSCODE |
static java.lang.String |
RECEIPT |
static java.lang.String |
RECEIPT_ID |
static java.lang.String |
SERVER |
static java.lang.String |
SESSION |
static java.lang.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(java.lang.String headerName,
java.lang.String headerValue)
Add the given, single header value under the given name.
|
void |
addAll(MultiValueMap<java.lang.String,java.lang.String> values)
Add all the values of the given
MultiValueMap to the current values. |
void |
addAll(java.lang.String headerName,
java.util.List<? extends java.lang.String> headerValues)
Add all the values of the given list to the current list of values for the given key.
|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> |
entrySet() |
boolean |
equals(java.lang.Object other) |
java.util.List<java.lang.String> |
get(java.lang.Object key) |
java.lang.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.
|
java.lang.String |
getDestination()
Get the destination header.
|
java.lang.String |
getFirst(java.lang.String headerName)
Return the first header value for the given header name, if any.
|
long[] |
getHeartbeat()
Get the heartbeat header.
|
java.lang.String |
getHost()
Get the host header.
|
java.lang.String |
getId()
Get the id header.
|
java.lang.String |
getLogin()
Get the login header.
|
java.lang.String |
getMessageId()
Get the message-id header.
|
java.lang.String |
getPasscode()
Get the passcode header.
|
java.lang.String |
getReceipt()
Get the receipt header.
|
java.lang.String |
getReceiptId()
Get the receipt header.
|
java.lang.String |
getServer()
Get the server header.
|
java.lang.String |
getSession()
Get the session header.
|
java.lang.String |
getSubscription()
Get the subscription header.
|
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isHeartbeatEnabled()
Whether heartbeats are enabled.
|
java.util.Set<java.lang.String> |
keySet() |
java.util.List<java.lang.String> |
put(java.lang.String key,
java.util.List<java.lang.String> value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> map) |
static StompHeaders |
readOnlyStompHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
Return a
StompHeaders object that can only be read, not written to. |
java.util.List<java.lang.String> |
remove(java.lang.Object key) |
void |
set(java.lang.String headerName,
java.lang.String headerValue)
Set the given, single header value under the given name.
|
void |
setAck(java.lang.String ack)
Set the ack header to one of "auto", "client", or "client-individual".
|
void |
setAll(java.util.Map<java.lang.String,java.lang.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(java.lang.String destination)
Set the destination header.
|
void |
setHeartbeat(long[] heartbeat)
Set the heartbeat header.
|
void |
setHost(java.lang.String host)
Set the host header.
|
void |
setId(java.lang.String id)
Set the id header.
|
void |
setLogin(java.lang.String login)
Set the login header.
|
void |
setMessageId(java.lang.String messageId)
Set the message-id header.
|
void |
setPasscode(java.lang.String passcode)
Set the passcode header.
|
void |
setReceipt(java.lang.String receipt)
Set the receipt header.
|
void |
setReceiptId(java.lang.String receiptId)
Set the receipt-id header.
|
void |
setServer(java.lang.String server)
Set the server header.
|
void |
setSession(java.lang.String session)
Set the session header.
|
void |
setSubscription(java.lang.String subscription)
Set the login header.
|
int |
size() |
java.util.Map<java.lang.String,java.lang.String> |
toSingleValueMap()
Returns the first values contained in this
MultiValueMap . |
java.lang.String |
toString() |
java.util.Collection<java.util.List<java.lang.String>> |
values() |
public static final java.lang.String CONTENT_TYPE
public static final java.lang.String CONTENT_LENGTH
public static final java.lang.String RECEIPT
public static final java.lang.String HOST
public static final java.lang.String LOGIN
public static final java.lang.String PASSCODE
public static final java.lang.String HEARTBEAT
public static final java.lang.String SESSION
public static final java.lang.String SERVER
public static final java.lang.String DESTINATION
public static final java.lang.String ID
public static final java.lang.String ACK
public static final java.lang.String SUBSCRIPTION
public static final java.lang.String MESSAGE_ID
public static final java.lang.String RECEIPT_ID
public StompHeaders()
public void setContentType(@Nullable MimeType mimeType)
public void setContentLength(long contentLength)
public long getContentLength()
public void setReceipt(@Nullable java.lang.String receipt)
@Nullable public java.lang.String getReceipt()
public void setHost(@Nullable java.lang.String host)
@Nullable public java.lang.String getHost()
public void setLogin(@Nullable java.lang.String login)
@Nullable public java.lang.String getLogin()
public void setPasscode(@Nullable java.lang.String passcode)
@Nullable public java.lang.String getPasscode()
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 java.lang.String session)
@Nullable public java.lang.String getSession()
public void setServer(@Nullable java.lang.String server)
@Nullable public java.lang.String getServer()
public void setDestination(@Nullable java.lang.String destination)
@Nullable public java.lang.String getDestination()
public void setId(@Nullable java.lang.String id)
@Nullable public java.lang.String getId()
public void setAck(@Nullable java.lang.String ack)
@Nullable public java.lang.String getAck()
public void setSubscription(@Nullable java.lang.String subscription)
@Nullable public java.lang.String getSubscription()
public void setMessageId(@Nullable java.lang.String messageId)
@Nullable public java.lang.String getMessageId()
public void setReceiptId(@Nullable java.lang.String receiptId)
@Nullable public java.lang.String getReceiptId()
@Nullable public java.lang.String getFirst(java.lang.String headerName)
getFirst
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header namenull
if nonepublic void add(java.lang.String headerName, @Nullable java.lang.String headerValue)
add
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
set(String, String)
public void addAll(java.lang.String headerName, java.util.List<? extends java.lang.String> headerValues)
MultiValueMap
addAll
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- they keyheaderValues
- the values to be addedpublic void addAll(MultiValueMap<java.lang.String,java.lang.String> values)
MultiValueMap
MultiValueMap
to the current values.addAll
in interface MultiValueMap<java.lang.String,java.lang.String>
values
- the values to be addedpublic void set(java.lang.String headerName, @Nullable java.lang.String headerValue)
set
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
add(String, String)
public void setAll(java.util.Map<java.lang.String,java.lang.String> values)
MultiValueMap
setAll
in interface MultiValueMap<java.lang.String,java.lang.String>
values
- the values.public java.util.Map<java.lang.String,java.lang.String> toSingleValueMap()
MultiValueMap
MultiValueMap
.toSingleValueMap
in interface MultiValueMap<java.lang.String,java.lang.String>
public int size()
size
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.List<java.lang.String> get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.List<java.lang.String> put(java.lang.String key, java.util.List<java.lang.String> value)
put
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.List<java.lang.String> remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public void putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> map)
putAll
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.Collection<java.util.List<java.lang.String>> values()
values
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean equals(java.lang.Object other)
equals
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static StompHeaders readOnlyStompHeaders(@Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
StompHeaders
object that can only be read, not written to.