Class AbstractMessage
- java.lang.Object
-
- org.red5.compatibility.flex.messaging.messages.AbstractMessage
-
- All Implemented Interfaces:
Serializable,Message
- Direct Known Subclasses:
AsyncMessage,RPCMessage
public class AbstractMessage extends Object implements Message, Serializable
Base class for all Flex compatibility messages.- Author:
- The Red5 Project, Joachim Bauch (jojo@struktur.de)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description ObjectbodyStringclientIdprotected byte[]clientIdBytesStringdestinationMap<String,Object>headersStringmessageIdprotected byte[]messageIdByteslongtimestamplongtimeToLive-
Fields inherited from interface org.red5.compatibility.flex.messaging.messages.Message
DESTINATION_CLIENT_ID_HEADER, ENDPOINT_HEADER, FLEX_CLIENT_ID_HEADER, MESSAGING_VERSION, NEEDS_CONFIG_HEADER, POLL_WAIT_HEADER, PRESERVE_DURABLE_HEADER, REMOTE_CREDENTIALS_HEADER, REMOVE_SUBSCRIPTIONS, SELECTOR_HEADER, SUBSCRIPTION_INVALIDATED_HEADER, SUBTOPIC_SEPARATOR, SYNC_HEADER
-
-
Constructor Summary
Constructors Constructor Description AbstractMessage()Initialize default message fields.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddParameters(StringBuilder result)Add message properties to string.ObjectgetBody()Returns the body of the message.StringgetClientId()Returns the client id indicating the client that sent the message.StringgetDestination()Returns the destination that the message targets.ObjectgetHeader(String name)Returns a header value corresponding to the passed header name.Map<String,Object>getHeaders()Returns the headers for the message.StringgetMessageId()Returns the unique message id.longgetTimestamp()Returns the timestamp for the message.longgetTimeToLive()Returns the time to live for the message.booleanheaderExists(String name)Tests whether a header with the passed name exists.voidreadExternal(IDataInput input)protected short[]readFlags(IDataInput input)voidsetBody(Object value)Sets the body of the message.voidsetClientId(String value)Sets the client id indicating the client that sent the message.voidsetDestination(String value)Sets the destination that the message targets.voidsetHeader(String name, Object value)Sets a header on the message.voidsetHeaders(Map<String,Object> value)Sets the headers for the message.voidsetMessageId(String value)Sets the unique message id.voidsetTimestamp(long value)Sets the timestamp for the message.voidsetTimeToLive(long value)Sets the time to live for the message.StringtoString()Return string representation of the message.voidwriteExternal(IDataOutput output)
-
-
-
Method Detail
-
addParameters
protected void addParameters(StringBuilder result)
Add message properties to string.- Parameters:
result-StringBuilderto add properties to
-
getBody
public Object getBody()
Description copied from interface:MessageReturns the body of the message.
-
getClientId
public String getClientId()
Description copied from interface:MessageReturns the client id indicating the client that sent the message.- Specified by:
getClientIdin interfaceMessage- Returns:
- client id
-
getDestination
public String getDestination()
Description copied from interface:MessageReturns the destination that the message targets.- Specified by:
getDestinationin interfaceMessage- Returns:
- destination
-
getHeader
public Object getHeader(String name)
Description copied from interface:MessageReturns a header value corresponding to the passed header name.
-
getHeaders
public Map<String,Object> getHeaders()
Description copied from interface:MessageReturns the headers for the message.- Specified by:
getHeadersin interfaceMessage- Returns:
- headers
-
getMessageId
public String getMessageId()
Description copied from interface:MessageReturns the unique message id.- Specified by:
getMessageIdin interfaceMessage- Returns:
- message id
-
getTimestamp
public long getTimestamp()
Description copied from interface:MessageReturns the timestamp for the message.- Specified by:
getTimestampin interfaceMessage- Returns:
- timestamp
-
getTimeToLive
public long getTimeToLive()
Description copied from interface:MessageReturns the time to live for the message.- Specified by:
getTimeToLivein interfaceMessage- Returns:
- time to live
-
headerExists
public boolean headerExists(String name)
Description copied from interface:MessageTests whether a header with the passed name exists.- Specified by:
headerExistsin interfaceMessage- Parameters:
name- header name- Returns:
- true if header exists, false otherwise
-
setBody
public void setBody(Object value)
Description copied from interface:MessageSets the body of the message.
-
setClientId
public void setClientId(String value)
Description copied from interface:MessageSets the client id indicating the client that sent the message.- Specified by:
setClientIdin interfaceMessage- Parameters:
value- client id
-
setDestination
public void setDestination(String value)
Description copied from interface:MessageSets the destination that the message targets.- Specified by:
setDestinationin interfaceMessage- Parameters:
value- destination
-
setHeader
public void setHeader(String name, Object value)
Description copied from interface:MessageSets a header on the message.
-
setHeaders
public void setHeaders(Map<String,Object> value)
Description copied from interface:MessageSets the headers for the message.- Specified by:
setHeadersin interfaceMessage- Parameters:
value- header values
-
setMessageId
public void setMessageId(String value)
Description copied from interface:MessageSets the unique message id.- Specified by:
setMessageIdin interfaceMessage- Parameters:
value- message id
-
setTimestamp
public void setTimestamp(long value)
Description copied from interface:MessageSets the timestamp for the message.- Specified by:
setTimestampin interfaceMessage- Parameters:
value- timestamp
-
setTimeToLive
public void setTimeToLive(long value)
Description copied from interface:MessageSets the time to live for the message.- Specified by:
setTimeToLivein interfaceMessage- Parameters:
value- ttl
-
toString
public String toString()
Return string representation of the message.
-
readFlags
protected short[] readFlags(IDataInput input)
-
readExternal
public void readExternal(IDataInput input)
-
writeExternal
public void writeExternal(IDataOutput output)
-
-