|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmpp.packet.JID
public class JID
An XMPP address (JID). A JID is made up of a node (generally a username), a domain, and a resource. The node and resource are optional; domain is required. In simple ABNF form:
Constructor Summary | |
---|---|
JID()
Constructor added for Externalizable. |
|
JID(String jid)
Constructs a JID from it's String representation. |
|
JID(String node,
String domain,
String resource)
Constructs a JID given a node, domain, and resource. |
|
JID(String node,
String domain,
String resource,
boolean skipStringprep)
Constructs a JID given a node, domain, and resource being able to specify if stringprep should be applied or not. |
Method Summary | |
---|---|
int |
compareTo(JID jid)
|
boolean |
equals(Object object)
|
static boolean |
equals(String jid1,
String jid2)
Returns true if two JID's are equivalent. |
static String |
escapeNode(String node)
Escapes the node portion of a JID according to "JID Escaping" (JEP-0106). |
String |
getDomain()
Returns the domain. |
String |
getNode()
Returns the node, or null if this JID does not contain node information. |
String |
getResource()
Returns the resource, or null if this JID does not contain resource information. |
int |
hashCode()
|
void |
readExternal(ObjectInput in)
|
static String |
resourceprep(String resource)
|
String |
toBareJID()
Returns the String representation of the bare JID, which is the JID with resource information removed. |
String |
toString()
Returns a String representation of the JID. |
static String |
unescapeNode(String node)
Un-escapes the node portion of a JID according to "JID Escaping" (JEP-0106). |
void |
writeExternal(ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JID()
public JID(String jid)
jid
- a valid JID.
IllegalArgumentException
- if the JID is not valid.public JID(String node, String domain, String resource)
node
- the node.domain
- the domain, which must not be null.resource
- the resource.
IllegalArgumentException
- if the JID is not valid.public JID(String node, String domain, String resource, boolean skipStringprep)
node
- the node.domain
- the domain, which must not be null.resource
- the resource.skipStringprep
- true if stringprep should not be applied.
IllegalArgumentException
- if the JID is not valid.Method Detail |
---|
public static String escapeNode(String node)
Unescaped Character | Encoded Sequence |
<space> | \20 |
" | \22 |
& | \26 |
' | \27 |
/ | \2f |
: | \3a |
< | \3c |
> | \3e |
@ | \40 |
\ | \5c |
This process is useful when the node comes from an external source that doesn't conform to nodeprep. For example, a username in LDAP may be "Joe Smith". Because the <space> character isn't a valid part of a node, the username should be escaped to "Joe\20Smith" before being made into a JID (e.g. "joe\20smith@example.com" after case-folding, etc. has been applied).
All node escaping and un-escaping must be performed manually at the appropriate time; the JID class will not escape or un-escape automatically.
node
- the node.
public static String unescapeNode(String node)
Escaping replaces characters prohibited by node-prep with escape sequences, as follows:
Unescaped Character | Encoded Sequence |
<space> | \20 |
" | \22 |
& | \26 |
' | \27 |
/ | \2f |
: | \3a |
< | \3c |
> | \3e |
@ | \40 |
\ | \5c |
This process is useful when the node comes from an external source that doesn't conform to nodeprep. For example, a username in LDAP may be "Joe Smith". Because the <space> character isn't a valid part of a node, the username should be escaped to "Joe\20Smith" before being made into a JID (e.g. "joe\20smith@example.com" after case-folding, etc. has been applied).
All node escaping and un-escaping must be performed manually at the appropriate time; the JID class will not escape or un-escape automatically.
node
- the escaped version of the node.
public static String resourceprep(String resource) throws org.jivesoftware.stringprep.StringprepException
org.jivesoftware.stringprep.StringprepException
public String getNode()
public String getDomain()
public String getResource()
public String toBareJID()
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object object)
equals
in class Object
public int compareTo(JID jid)
compareTo
in interface Comparable<JID>
public static boolean equals(String jid1, String jid2)
jid1
- a JID.jid2
- a JID.
IllegalArgumentException
- if either JID is not valid.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |