|
Openfire 3.6.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmpp.packet.Packet
public abstract class Packet
An XMPP packet (also referred to as a stanza). Each packet is backed by a DOM4J Element. A set of convenience methods allows easy manipulation of the Element, or the Element can be accessed directly and manipulated.
There are three core packet types:
Message
-- used to send data between users.
Presence
-- contains user presence information or is used
to manage presence subscriptions.
IQ
-- exchange information and perform queries using a
request/response protocol.
Field Summary | |
---|---|
protected static org.dom4j.DocumentFactory |
docFactory
|
protected org.dom4j.Element |
element
|
protected JID |
fromJID
|
protected JID |
toJID
|
Constructor Summary | |
---|---|
protected |
Packet()
Constructs a new Packet with no element data. |
|
Packet(org.dom4j.Element element)
Constructs a new Packet. |
|
Packet(org.dom4j.Element element,
boolean skipValidation)
Constructs a new Packet. |
Method Summary | |
---|---|
void |
addExtension(PacketExtension extension)
Adds the element contained in the PacketExtension to the element of this packet. |
abstract Packet |
createCopy()
Creates a deep copy of this packet. |
boolean |
deleteExtension(String name,
String namespace)
Deletes the first element whose element name and namespace matches the specified element name and namespace. |
org.dom4j.Element |
getElement()
Returns the DOM4J Element that backs the packet. |
PacketError |
getError()
Returns the packet error, or null if there is no packet error. |
PacketExtension |
getExtension(String name,
String namespace)
Returns a PacketExtension on the first element found in this packet
for the specified name and namespace or null if
none was found. |
JID |
getFrom()
Returns the XMPP address (JID) that the packet is from, or null if the "from" attribute is not set. |
String |
getID()
Returns the packet ID, or null if the packet does not have an ID. |
JID |
getTo()
Returns the XMPP address (JID) that the packet is addressed to, or null if the "to" attribute is not set. |
void |
setError(PacketError.Condition condition)
Sets the packet error using the specified condition. |
void |
setError(PacketError error)
Sets the packet error. |
void |
setFrom(JID from)
Sets the XMPP address (JID) that the packet comes from. |
void |
setFrom(String from)
Sets the XMPP address (JID) that the packet comes from. |
void |
setID(String ID)
Sets the packet ID. |
void |
setTo(JID to)
Sets the XMPP address (JID) that the packet is address to. |
void |
setTo(String to)
Sets the XMPP address (JID) that the packet is addressed to. |
String |
toString()
|
String |
toXML()
Returns the textual XML representation of this packet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static org.dom4j.DocumentFactory docFactory
protected org.dom4j.Element element
protected JID toJID
protected JID fromJID
Constructor Detail |
---|
public Packet(org.dom4j.Element element)
element
- the XML Element that contains the packet contents.public Packet(org.dom4j.Element element, boolean skipValidation)
element
- the XML Element that contains the packet contents.skipValidation
- true if stringprep should not be applied to the TO address.protected Packet()
Method Detail |
---|
public String getID()
public void setID(String ID)
ID
- the packet ID.public JID getTo()
public void setTo(String to)
to
- the XMPP address (JID) that the packet is addressed to.public void setTo(JID to)
to
- the XMPP address (JID) that the packet is addressed to.public JID getFrom()
public void setFrom(String from)
from
- the XMPP address (JID) that the packet comes from.public void setFrom(JID from)
from
- the XMPP address (JID) that the packet comes from.public void addExtension(PacketExtension extension)
extension
- the PacketExtension whose element will be added to this Packet's element.public PacketExtension getExtension(String name, String namespace)
PacketExtension
on the first element found in this packet
for the specified name and namespace or null if
none was found.
name
- the child element name.namespace
- the child element namespace.
public boolean deleteExtension(String name, String namespace)
Notice that this method may remove any child element that matches the specified
element name and namespace even if that element was not added to the Packet using a
PacketExtension
.
name
- the child element name.namespace
- the child element namespace.
public PacketError getError()
public void setError(PacketError error)
error
- the packet error.public void setError(PacketError.Condition condition)
condition
- the error condition.public abstract Packet createCopy()
public org.dom4j.Element getElement()
public String toXML()
public String toString()
toString
in class Object
|
Openfire 3.6.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |