| java.lang.Object org.xmpp.packet.Packet org.xmpp.packet.Message
All known Subclasses: org.jivesoftware.openfire.OfflineMessage, org.xmpp.muc.Invitation,
Message | public class Message extends Packet (Code) | | Message packet.
A message can have one of several
Type Types . For each message type,
different message fields are typically used as follows:
| Message type |
Field | Normal | Chat | Group Chat | Headline | Error |
subject | SHOULD | SHOULD NOT | SHOULD NOT | SHOULD NOT | SHOULD NOT |
thread | OPTIONAL | SHOULD | OPTIONAL | OPTIONAL | SHOULD NOT |
body | SHOULD | SHOULD | SHOULD | SHOULD | SHOULD NOT |
error | MUST NOT | MUST NOT | MUST NOT | MUST NOT | MUST |
|
Inner Class :public enum Type | |
Constructor Summary | |
public | Message() Constructs a new Message. | public | Message(Element element) Constructs a new Message using an existing Element. | public | Message(Element element, boolean skipValidation) Constructs a new Message using an existing Element. |
Method Summary | |
public Element | addChildElement(String name, String namespace) Adds a new child element to this packet with the given name and
namespace. | public Message | createCopy() Returns a deep copy of this Message. | public String | getBody() Returns the body of this message or null if there is no body. | public Element | getChildElement(String name, String namespace) Returns the first child element of this packet that matches the
given name and namespace. | public String | getSubject() Returns the subject of this message or null if there is no subject.. | public String | getThread() Returns the thread value of this message, an identifier that is used for
tracking a conversation thread ("instant messaging session")
between two entities. | public Type | getType() | public void | setBody(String body) Sets the body of this message. | public void | setSubject(String subject) Sets the subject of this message. | public void | setThread(String thread) Sets the thread value of this message, an identifier that is used for
tracking a conversation thread ("instant messaging session")
between two entities. | public void | setType(Type type) Sets the type of this message. |
Message | public Message()(Code) | | Constructs a new Message.
|
Message | public Message(Element element)(Code) | | Constructs a new Message using an existing Element. This is useful
for parsing incoming message Elements into Message objects.
Parameters: element - the message Element. |
Message | public Message(Element element, boolean skipValidation)(Code) | | Constructs a new Message using an existing Element. This is useful
for parsing incoming message Elements into Message objects. Stringprep validation
on the TO address can be disabled. The FROM address will not be validated since the
server is the one that sets that value.
Parameters: element - the message Element. Parameters: skipValidation - true if stringprep should not be applied to the TO address. |
addChildElement | public Element addChildElement(String name, String namespace)(Code) | | Adds a new child element to this packet with the given name and
namespace. The newly created Element is returned. This is a
convenience method to avoid manipulating this underlying packet's
Element instance directly.
Child elements in extended namespaces are used to extend the features
of XMPP. Examples include a "user is typing" indicator and invitations to
group chat rooms. Although any valid XML can be included in a child element
in an extended namespace, many common features have been standardized
as Jabber Enhancement Proposals
(JEPs).
Parameters: name - the element name. Parameters: namespace - the element namespace. the newly created child element. |
createCopy | public Message createCopy()(Code) | | Returns a deep copy of this Message.
a deep copy of this Message. |
getBody | public String getBody()(Code) | | Returns the body of this message or null if there is no body.
the body. |
getChildElement | public Element getChildElement(String name, String namespace)(Code) | | Returns the first child element of this packet that matches the
given name and namespace. If no matching element is found,
null will be returned. This is a convenience method to avoid
manipulating this underlying packet's Element instance directly.
Child elements in extended namespaces are used to extend the features
of XMPP. Examples include a "user is typing" indicator and invitations to
group chat rooms. Although any valid XML can be included in a child element
in an extended namespace, many common features have been standardized
as Jabber Enhancement Proposals
(JEPs).
Parameters: name - the element name. Parameters: namespace - the element namespace. the first matching child element, or null if thereis no matching child element. |
getSubject | public String getSubject()(Code) | | Returns the subject of this message or null if there is no subject..
the subject. |
getThread | public String getThread()(Code) | | Returns the thread value of this message, an identifier that is used for
tracking a conversation thread ("instant messaging session")
between two entities. If the thread is not set, null will be
returned.
the thread value. |
getType | public Type getType()(Code) | | Returns the type of this message
the message type. See Also: Type |
setBody | public void setBody(String body)(Code) | | Sets the body of this message.
Parameters: body - the body. |
setSubject | public void setSubject(String subject)(Code) | | Sets the subject of this message.
Parameters: subject - the subject. |
setThread | public void setThread(String thread)(Code) | | Sets the thread value of this message, an identifier that is used for
tracking a conversation thread ("instant messaging session")
between two entities.
Parameters: thread - thread value. |
setType | public void setType(Type type)(Code) | | Sets the type of this message.
Parameters: type - the message type. See Also: Type |
|
|