|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openid4java.discovery.yadis.YadisResolver
public class YadisResolver
Yadis discovery protocol implementation.
Yadis discovery protocol returns a Yadis Resource Descriptor (XRDS) document associated with a Yadis Identifier (YadisID)
YadisIDs can be any type of identifiers that are resolvable to a URL form, and in addition the URL form uses a HTTP or a HTTPS schema. Such an URL is defined by the Yadis speficification as a YadisURL. This functionality is implemented by the YadisURL helper class.
The discovery of the XRDS document is performed by the discover method on a YadisUrl.
Internal parameters used during the discovery process :
| Field Summary | |
|---|---|
private int |
_connTimeout
HTTP connect timeout, in milliseconds. |
private static org.apache.commons.logging.Log |
_log
|
private int |
_maxHtmlSize
Maximum length (in bytes) to read when parsing a HTML response. |
private int |
_maxRedirects
Maximum number of redirects to be followed for the HTTP calls. |
private int |
_maxXmlSize
Maximum size in bytes for the XRDS document. |
private int |
_socketTimeout
HTTP socket (read) timeout, in milliseconds. |
private static boolean |
DEBUG
|
private static java.lang.String |
YADIS_ACCEPT_HEADER
|
private static java.lang.String |
YADIS_CONTENT_TYPE
|
private static java.lang.String |
YADIS_XRDS_LOCATION
|
| Constructor Summary | |
|---|---|
YadisResolver()
Instantiates a YadisResolver with default values for the internal parameters. |
|
| Method Summary | |
|---|---|
YadisResult |
discover(java.lang.String url)
Performs Yadis discovery on the YadisURL. |
YadisResult |
discover(java.lang.String url,
int maxRedirects)
Performs Yadis discovery on the YadisURL. |
int |
getConnTimeout()
Gets the HTTP connect timeout, in milliseconds. |
private java.lang.String |
getHtmlMeta(java.io.InputStream input)
Parses the HTML input stream and scans for the Yadis XRDS location in the HTML HEAD Meta tags. |
int |
getMaxHtmlSize()
Gets the aximum length (in bytes) to read when parsing a HTML response. |
int |
getMaxRedirects()
Gets the internal limit configured for the maximum number of redirects to be followed for the HTTP calls. |
int |
getMaxXmlSize()
Gets the maximum size in bytes for the XRDS document. |
int |
getSocketTimeout()
Gets the HTTP socket (read) timeout, in milliseconds. |
private void |
getXrds(org.apache.commons.httpclient.HttpClient client,
YadisResult result,
boolean secondCall)
Tries to retrieve the XRDS document via a GET call on the provided URL. |
private void |
headXrdsUrl(org.apache.commons.httpclient.HttpClient client,
YadisUrl url,
YadisResult result)
Tries to retrieve the XRDS location url by performing a cheap HEAD call on the YadisURL. |
private org.openxri.xml.XRDS |
parseXrds(java.io.InputStream input)
Parses the input stream and build a XRDS document from it. |
void |
setConnTimeout(int connTimeout)
Sets the HTTP connect timeout, in milliseconds. |
void |
setMaxHtmlSize(int maxHtmlSize)
Sets maximum length (in bytes) to read when parsing a HTML response. |
void |
setMaxRedirects(int maxRedirects)
Sets the maximum number of redirects to be followed for the HTTP calls. |
void |
setMaxXmlSize(int maxXmlSize)
Sets the maximum size in bytes for the XRDS document. |
void |
setSocketTimeout(int socketTimeout)
Sets HTTP socket (read) timeout, in milliseconds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static org.apache.commons.logging.Log _log
private static final boolean DEBUG
private static final java.lang.String YADIS_XRDS_LOCATION
private static final java.lang.String YADIS_CONTENT_TYPE
private static final java.lang.String YADIS_ACCEPT_HEADER
private int _maxRedirects
private int _maxHtmlSize
private int _maxXmlSize
private int _connTimeout
private int _socketTimeout
| Constructor Detail |
|---|
public YadisResolver()
| Method Detail |
|---|
public int getMaxRedirects()
public void setMaxRedirects(int maxRedirects)
public int getMaxHtmlSize()
public void setMaxHtmlSize(int maxHtmlSize)
public int getMaxXmlSize()
public void setMaxXmlSize(int maxXmlSize)
public int getConnTimeout()
public void setConnTimeout(int connTimeout)
public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
public YadisResult discover(java.lang.String url)
throws YadisException
The maximum number of redirects that are followed is determined by the #_maxRedirects member field.
url - YadisURL on which discovery will be performed
YadisExceptionYadisResult, #discover(String, int)
public YadisResult discover(java.lang.String url,
int maxRedirects)
throws YadisException
url - YadisURL on which discovery will be performedmaxRedirects - The maximum number of redirects to be followed.
YadisExceptionYadisResult
private void getXrds(org.apache.commons.httpclient.HttpClient client,
YadisResult result,
boolean secondCall)
throws YadisException
client - The HttpClient object to use for placing the callresult - The YadisResult object where discovery results
will be storedsecondCall - true on the second (recursive) call
YadisException - (hard-fail) if:
private java.lang.String getHtmlMeta(java.io.InputStream input)
throws YadisException
input - input data stream
YadisException - on parsing errors or Yadis protocal violations
private org.openxri.xml.XRDS parseXrds(java.io.InputStream input)
throws YadisException
input - input data stream
YadisException - if the input stream does not contain a valid XRDS
private void headXrdsUrl(org.apache.commons.httpclient.HttpClient client,
YadisUrl url,
YadisResult result)
throws YadisException
The returned string should be validated before being used as a XRDS-Location URL.
client - The HttpClient object to use for placing the callurl - The YadisURLresult - The location of the XRDS document and the normalized
Url will be returned in the YadisResult object.
The location of the XRDS document will be null if:
YadisException - if:
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||