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 |
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()
Return a
Map with 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(MimeType mimeType)
public MimeType getContentType()
public void setContentLength(long contentLength)
public long getContentLength()
public void setReceipt(java.lang.String receipt)
public java.lang.String getReceipt()
public void setHost(java.lang.String host)
public java.lang.String getHost()
public void setLogin(java.lang.String login)
public java.lang.String getLogin()
public void setPasscode(java.lang.String passcode)
public java.lang.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(java.lang.String session)
public java.lang.String getSession()
public void setServer(java.lang.String server)
public java.lang.String getServer()
public void setDestination(java.lang.String destination)
public java.lang.String getDestination()
public void setId(java.lang.String id)
public java.lang.String getId()
public void setAck(java.lang.String ack)
public java.lang.String getAck()
public void setSubscription(java.lang.String subscription)
public java.lang.String getSubscription()
public void setMessageId(java.lang.String messageId)
public java.lang.String getMessageId()
public void setReceiptId(java.lang.String receiptId)
public java.lang.String getReceiptId()
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, 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 set(java.lang.String headerName, 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
Map
with the first values contained in this 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(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
StompHeaders
object that can only be read, not written to.