public final class HttpLookupMethod
extends java.lang.Object
In order to obtain host-meta XRD element from the host in the form of an InputStream,
use getXrdStream(DomainBareJid) method. To obtain endpoints for Bosh or Websocket
connection endpoints from host, use HttpLookupMethod.LinkRelation.BOSH and HttpLookupMethod.LinkRelation.WEBSOCKET
respectively with the lookup(DomainBareJid, LinkRelation) method. In case one is looking
for endpoints described by other than BOSH or Websocket LinkRelation, use the more flexible
lookup(DomainBareJid, String) method.
DomainBareJid xmppServerAddress = JidCreate.domainBareFrom("example.org");
List<URI> endpoints = HttpLookupMethod.lookup(xmppServiceAddress, LinkRelation.WEBSOCKET);
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpLookupMethod.LinkRelation
Specifies a link relation for the selected type of connection.
|
| Constructor and Description |
|---|
HttpLookupMethod() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.InputStream |
getXrdStream(org.jxmpp.jid.DomainBareJid xmppServiceAddress)
Constructs a HTTP connection with the host specified by the DomainBareJid
and retrieves XRD element in the form of an InputStream.
|
static java.util.List<java.net.URI> |
lookup(org.jxmpp.jid.DomainBareJid xmppServiceAddress,
HttpLookupMethod.LinkRelation relation)
Get remote endpoints for the given LinkRelation from host.
|
static java.util.List<java.net.URI> |
lookup(org.jxmpp.jid.DomainBareJid xmppServiceAddress,
java.lang.String relation)
Get remote endpoints for the given LinkRelation from host.
|
static java.util.List<java.net.URI> |
parseXrdLinkReferencesFor(org.jivesoftware.smack.xml.XmlPullParser parser,
HttpLookupMethod.LinkRelation relation)
Get remote endpoints for the provided LinkRelation from provided XmlPullParser.
|
static java.util.List<java.net.URI> |
parseXrdLinkReferencesFor(org.jivesoftware.smack.xml.XmlPullParser parser,
java.lang.String relation)
Get remote endpoints for the provided LinkRelation from provided XmlPullParser.
|
public static java.util.List<java.net.URI> lookup(org.jxmpp.jid.DomainBareJid xmppServiceAddress,
java.lang.String relation)
throws java.io.IOException,
org.jivesoftware.smack.xml.XmlPullParserException,
java.net.URISyntaxException
xmppServiceAddress - address of hostrelation - LinkRelation as a string specifying type of connectionjava.io.IOException - exception due to input/output operationsorg.jivesoftware.smack.xml.XmlPullParserException - exception encountered during XML parsingjava.net.URISyntaxException - exception to indicate that a string could not be parsed as a URI referencepublic static java.util.List<java.net.URI> lookup(org.jxmpp.jid.DomainBareJid xmppServiceAddress,
HttpLookupMethod.LinkRelation relation)
throws java.io.IOException,
org.jivesoftware.smack.xml.XmlPullParserException,
java.net.URISyntaxException
xmppServiceAddress - address of hostrelation - HttpLookupMethod.LinkRelation specifying type of connectionjava.io.IOException - exception due to input/output operationsorg.jivesoftware.smack.xml.XmlPullParserException - exception encountered during XML parsingjava.net.URISyntaxException - exception to indicate that a string could not be parsed as a URI referencepublic static java.io.InputStream getXrdStream(org.jxmpp.jid.DomainBareJid xmppServiceAddress)
throws java.io.IOException
FileNotFoundException if host-meta isn't published.xmppServiceAddress - address of hostjava.io.IOException - exception due to input/output operationspublic static java.util.List<java.net.URI> parseXrdLinkReferencesFor(org.jivesoftware.smack.xml.XmlPullParser parser,
java.lang.String relation)
throws java.io.IOException,
org.jivesoftware.smack.xml.XmlPullParserException,
java.net.URISyntaxException
parser - XmlPullParser that contains LinkRelationsrelation - type of endpoints specified by the given LinkRelationjava.io.IOException - exception due to input/output operationsorg.jivesoftware.smack.xml.XmlPullParserException - exception encountered during XML parsingjava.net.URISyntaxException - exception to indicate that a string could not be parsed as a URI referencepublic static java.util.List<java.net.URI> parseXrdLinkReferencesFor(org.jivesoftware.smack.xml.XmlPullParser parser,
HttpLookupMethod.LinkRelation relation)
throws java.io.IOException,
org.jivesoftware.smack.xml.XmlPullParserException,
java.net.URISyntaxException
parser - XmlPullParser that contains LinkRelationsrelation - type of endpoints specified by the given LinkRelationjava.io.IOException - exception due to input/output operationsorg.jivesoftware.smack.xml.XmlPullParserException - exception encountered during XML parsingjava.net.URISyntaxException - exception to indicate that a string could not be parsed as a URI reference