org.red5.compatibility.flex.messaging.messages

## Class AbstractMessage

- java.lang.Object
- - org.red5.compatibility.flex.messaging.messages.AbstractMessage

All Implemented Interfaces:
  Serializable, Message

Direct Known Subclasses:
  AsyncMessage

    public class AbstractMessage
    extends Object
    implements Message, Serializable

Base class for all Flex compatibility messages.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de)
See Also:
  Serialized Form

### Field Summary

Fields
`Object` `body`
`String` `clientId`
`protected byte[]` `clientIdBytes`
`String` `destination`
`Map<String,Object>` `headers`
`String` `messageId`
`protected byte[]` `messageIdBytes`
`long` `timestamp`
`long` `timeToLive`

### 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 and Description
`AbstractMessage()` Initialize default message fields.

### Method Summary

Methods
`protected void` `addParameters(StringBuilder result)` Add message properties to string.
`Object` `getBody()` Returns the body of the message.
`String` `getClientId()` Returns the client id indicating the client that sent the message.
`String` `getDestination()` Returns the destination that the message targets.
`Object` `getHeader(String name)` Returns a header value corresponding to the passed header name.
`Map<String,Object>` `getHeaders()` Returns the headers for the message.
`String` `getMessageId()` Returns the unique message id.
`long` `getTimestamp()` Returns the timestamp for the message.
`long` `getTimeToLive()` Returns the time to live for the message.
`boolean` `headerExists(String name)` Tests whether a header with the passed name exists.
`void` `readExternal(IDataInput input)`
`protected short[]` `readFlags(IDataInput input)`
`void` `setBody(Object value)` Sets the body of the message.
`void` `setClientId(String value)` Sets the client id indicating the client that sent the message.
`void` `setDestination(String value)` Sets the destination that the message targets.
`void` `setHeader(String name, Object value)` Sets a header on the message.
`void` `setHeaders(Map<String,Object> value)` Sets the headers for the message.
`void` `setMessageId(String value)` Sets the unique message id.
`void` `setTimestamp(long value)` Sets the timestamp for the message.
`void` `setTimeToLive(long value)` Sets the time to live for the message.
`String` `toString()` Return string representation of the message.
`void` `writeExternal(IDataOutput output)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### timestamp

    public long timestamp

#### headers

    public Map<String,Object> headers

#### body

    public Object body

#### messageId

    public String messageId

#### messageIdBytes

    protected byte[] messageIdBytes

#### timeToLive

    public long timeToLive

#### clientId

    public String clientId

#### clientIdBytes

    protected byte[] clientIdBytes

#### destination

    public String destination

### Constructor Detail

#### AbstractMessage

    public AbstractMessage()

Initialize default message fields.

### Method Detail

#### addParameters

    protected void addParameters(StringBuilder result)

Add message properties to string.

Parameters:
  `result` - `StringBuilder` to add properties to

#### getBody

    public Object getBody()

Description copied from interface: `Message`
Returns the body of the message.

Specified by:
  `getBody` in interface `Message`
Returns:
  message body

#### getClientId

    public String getClientId()

Description copied from interface: `Message`
Returns the client id indicating the client that sent the message.

Specified by:
  `getClientId` in interface `Message`
Returns:
  client id

#### getDestination

    public String getDestination()

Description copied from interface: `Message`
Returns the destination that the message targets.

Specified by:
  `getDestination` in interface `Message`
Returns:
  destination

#### getHeader

    public Object getHeader(String name)

Description copied from interface: `Message`
Returns a header value corresponding to the passed header name.

Specified by:
  `getHeader` in interface `Message`
Returns:
  header value

#### getHeaders

    public Map<String,Object> getHeaders()

Description copied from interface: `Message`
Returns the headers for the message.

Specified by:
  `getHeaders` in interface `Message`
Returns:
  headers

#### getMessageId

    public String getMessageId()

Description copied from interface: `Message`
Returns the unique message id.

Specified by:
  `getMessageId` in interface `Message`
Returns:
  message id

#### getTimestamp

    public long getTimestamp()

Description copied from interface: `Message`
Returns the timestamp for the message.

Specified by:
  `getTimestamp` in interface `Message`
Returns:
  timestamp

#### getTimeToLive

    public long getTimeToLive()

Description copied from interface: `Message`
Returns the time to live for the message.

Specified by:
  `getTimeToLive` in interface `Message`
Returns:
  time to live

#### headerExists

    public boolean headerExists(String name)

Description copied from interface: `Message`
Tests whether a header with the passed name exists.

Specified by:
  `headerExists` in interface `Message`
Returns:
  true if header exists, false otherwise

#### setBody

    public void setBody(Object value)

Description copied from interface: `Message`
Sets the body of the message.

Specified by:
  `setBody` in interface `Message`

#### setClientId

    public void setClientId(String value)

Description copied from interface: `Message`
Sets the client id indicating the client that sent the message.

Specified by:
  `setClientId` in interface `Message`

#### setDestination

    public void setDestination(String value)

Description copied from interface: `Message`
Sets the destination that the message targets.

Specified by:
  `setDestination` in interface `Message`

#### setHeader

    public void setHeader(String name,
                 Object value)

Description copied from interface: `Message`
Sets a header on the message.

Specified by:
  `setHeader` in interface `Message`

#### setHeaders

    public void setHeaders(Map<String,Object> value)

Description copied from interface: `Message`
Sets the headers for the message.

Specified by:
  `setHeaders` in interface `Message`

#### setMessageId

    public void setMessageId(String value)

Description copied from interface: `Message`
Sets the unique message id.

Specified by:
  `setMessageId` in interface `Message`

#### setTimestamp

    public void setTimestamp(long value)

Description copied from interface: `Message`
Sets the timestamp for the message.

Specified by:
  `setTimestamp` in interface `Message`

#### setTimeToLive

    public void setTimeToLive(long value)

Description copied from interface: `Message`
Sets the time to live for the message.

Specified by:
  `setTimeToLive` in interface `Message`

#### toString

    public String toString()

Return string representation of the message.

Overrides:
  `toString` in class `Object`
Returns:
  value

#### readFlags

    protected short[] readFlags(IDataInput input)

#### readExternal

    public void readExternal(IDataInput input)

#### writeExternal

    public void writeExternal(IDataOutput output)