Package org.cometd.server
Class ServerMessageImpl
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,java.lang.Object>
-
- org.cometd.common.HashMapMessage
-
- org.cometd.server.ServerMessageImpl
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,java.lang.Object>
,Message
,Message.Mutable
,ServerMessage
,ServerMessage.Mutable
public class ServerMessageImpl extends HashMapMessage implements ServerMessage.Mutable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.cometd.bayeux.Message
Message.Mutable
-
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerMessage
ServerMessage.Mutable
-
-
Field Summary
-
Fields inherited from interface org.cometd.bayeux.Message
ADVICE_FIELD, CHANNEL_FIELD, CLIENT_ID_FIELD, CONNECTION_TYPE_FIELD, DATA_FIELD, ERROR_FIELD, EXT_FIELD, ID_FIELD, INTERVAL_FIELD, MAX_INTERVAL_FIELD, MIN_VERSION_FIELD, RECONNECT_FIELD, RECONNECT_HANDSHAKE_VALUE, RECONNECT_NONE_VALUE, RECONNECT_RETRY_VALUE, SUBSCRIPTION_FIELD, SUCCESSFUL_FIELD, SUPPORTED_CONNECTION_TYPES_FIELD, TIMEOUT_FIELD, TIMESTAMP_FIELD, TRANSPORT_FIELD, VERSION_FIELD
-
-
Constructor Summary
Constructors Constructor Description ServerMessageImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>
entrySet()
protected void
freeze(java.lang.String json)
java.util.Map<java.lang.String,java.lang.Object>
getAdvice()
Convenience method to retrieve theMessage.ADVICE_FIELD
ServerMessage.Mutable
getAssociated()
BayeuxContext
getBayeuxContext()
java.lang.Object
getData()
Convenience method to retrieve theMessage.DATA_FIELD
java.util.Map<java.lang.String,java.lang.Object>
getDataAsMap()
java.util.Map<java.lang.String,java.lang.Object>
getExt()
Convenience method to retrieve theMessage.EXT_FIELD
java.lang.String
getJSON()
byte[]
getJSONBytes()
ServerTransport
getServerTransport()
protected boolean
isFrozen()
boolean
isHandled()
boolean
isLazy()
java.lang.Object
put(java.lang.String key, java.lang.Object value)
void
setAssociated(ServerMessage.Mutable associated)
void
setBayeuxContext(BayeuxContext context)
void
setHandled(boolean handled)
void
setLazy(boolean lazy)
A lazy message does not provoke immediately delivery to the client but it will be delivered at first occasion or after a timeout expiresvoid
setServerTransport(ServerTransport transport)
-
Methods inherited from class org.cometd.common.HashMapMessage
getAdvice, getChannel, getChannelId, getClientId, getDataAsMap, getExt, getId, isMeta, isPublishReply, isSuccessful, setChannel, setClientId, setData, setId, setSuccessful
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from interface org.cometd.bayeux.Message
getChannel, getChannelId, getClientId, getId, isMeta, isPublishReply, isSuccessful
-
Methods inherited from interface org.cometd.bayeux.Message.Mutable
getAdvice, getDataAsMap, getExt, setChannel, setClientId, setData, setId, setSuccessful
-
-
-
-
Method Detail
-
getAssociated
public ServerMessage.Mutable getAssociated()
- Specified by:
getAssociated
in interfaceServerMessage
- Returns:
- a message associated with this message on the server. Typically this is a meta message that the current message is being sent in response to.
-
setAssociated
public void setAssociated(ServerMessage.Mutable associated)
- Specified by:
setAssociated
in interfaceServerMessage.Mutable
- Parameters:
associated
- the message associated with this message
-
isLazy
public boolean isLazy()
- Specified by:
isLazy
in interfaceServerMessage
- Returns:
- true if the message is lazy and should not force the session's queue to be flushed
-
isHandled
public boolean isHandled()
-
getBayeuxContext
public BayeuxContext getBayeuxContext()
- Specified by:
getBayeuxContext
in interfaceServerMessage
- Returns:
- the BayeuxContext associated with this message
-
setBayeuxContext
public void setBayeuxContext(BayeuxContext context)
-
getServerTransport
public ServerTransport getServerTransport()
- Specified by:
getServerTransport
in interfaceServerMessage
- Returns:
- the ServerTransport associated with this message
-
setServerTransport
public void setServerTransport(ServerTransport transport)
-
setLazy
public void setLazy(boolean lazy)
Description copied from interface:ServerMessage.Mutable
A lazy message does not provoke immediately delivery to the client but it will be delivered at first occasion or after a timeout expires- Specified by:
setLazy
in interfaceServerMessage.Mutable
- Parameters:
lazy
- whether the message is lazy
-
setHandled
public void setHandled(boolean handled)
-
freeze
protected void freeze(java.lang.String json)
-
isFrozen
protected boolean isFrozen()
-
getJSON
public java.lang.String getJSON()
-
getJSONBytes
public byte[] getJSONBytes()
-
getData
public java.lang.Object getData()
Description copied from interface:Message
Convenience method to retrieve theMessage.DATA_FIELD
- Specified by:
getData
in interfaceMessage
- Overrides:
getData
in classHashMapMessage
- Returns:
- the data of the message
- See Also:
Message.getDataAsMap()
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)
- Specified by:
put
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
put
in classjava.util.HashMap<java.lang.String,java.lang.Object>
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
- Specified by:
entrySet
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
entrySet
in classjava.util.HashMap<java.lang.String,java.lang.Object>
-
getDataAsMap
public java.util.Map<java.lang.String,java.lang.Object> getDataAsMap()
- Specified by:
getDataAsMap
in interfaceMessage
- Overrides:
getDataAsMap
in classHashMapMessage
- Returns:
- the data of the message as a map
- See Also:
Message.getData()
-
getExt
public java.util.Map<java.lang.String,java.lang.Object> getExt()
Description copied from interface:Message
Convenience method to retrieve theMessage.EXT_FIELD
- Specified by:
getExt
in interfaceMessage
- Overrides:
getExt
in classHashMapMessage
- Returns:
- the ext of the message
-
getAdvice
public java.util.Map<java.lang.String,java.lang.Object> getAdvice()
Description copied from interface:Message
Convenience method to retrieve theMessage.ADVICE_FIELD
- Specified by:
getAdvice
in interfaceMessage
- Overrides:
getAdvice
in classHashMapMessage
- Returns:
- the advice of the message
-
-