|
||||||||||
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 HttpFetcher |
_httpFetcher
|
private static org.apache.commons.logging.Log |
_log
|
private int |
_maxRedirects
Maximum number of redirects to be followed for the HTTP calls. |
private static boolean |
DEBUG
|
private static XrdsParser |
XRDS_PARSER
|
private static java.lang.String |
XRDS_PARSER_CLASS_NAME_KEY
|
private static java.lang.String |
YADIS_ACCEPT_HEADER
|
private static java.lang.String |
YADIS_CONTENT_TYPE
|
private static YadisHtmlParser |
YADIS_HTML_PARSER
|
private static java.lang.String |
YADIS_HTML_PARSER_CLASS_NAME_KEY
|
static java.lang.String |
YADIS_XRDS_LOCATION
|
Constructor Summary | |
---|---|
YadisResolver(HttpFetcher httpFetcher)
|
|
YadisResolver(HttpFetcherFactory httpFetcherFactory)
|
Method Summary | |
---|---|
java.util.List |
discover(java.lang.String url)
Performs Yadis discovery on the YadisURL. |
java.util.List |
discover(java.lang.String url,
HttpFetcher httpFetcher)
Performs Yadis discovery on the YadisURL. |
java.util.List |
discover(java.lang.String url,
int maxRedirects)
Performs Yadis discovery on the YadisURL. |
java.util.List |
discover(java.lang.String url,
int maxRedirects,
HttpFetcher httpFetcher)
Performs Yadis discovery on the YadisURL. |
YadisResult |
discover(java.lang.String url,
int maxRedirects,
HttpFetcher httpFetcher,
java.util.Set serviceTypes)
|
YadisResult |
discover(java.lang.String url,
int maxRedirects,
java.util.Set serviceTypes)
|
java.util.List |
discoverRP(java.lang.String url)
Performs Relyin Party discovery on the supplied URL. |
private java.lang.String |
getHtmlMeta(java.lang.String input)
Parses the HTML input stream and scans for the Yadis XRDS location in the HTML HEAD Meta tags. |
HttpFetcher |
getHttpFetcher()
|
int |
getMaxRedirects()
Gets the internal limit configured for the maximum number of redirects to be followed for the HTTP calls. |
private void |
retrieveXrdsDocument(YadisResult result,
int maxRedirects,
java.util.Set serviceTypes)
Tries to retrieve the XRDS document via a GET call on XRDS location provided in the result parameter. |
private YadisResult |
retrieveXrdsLocation(YadisUrl url,
boolean useGet,
int maxRedirects,
java.util.Set serviceTypes)
Tries to retrieve the XRDS location url by performing a cheap HEAD call on the YadisURL. |
void |
setMaxRedirects(int maxRedirects)
Sets the maximum number of redirects to be followed for the HTTP calls. |
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
public 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 static final java.lang.String YADIS_HTML_PARSER_CLASS_NAME_KEY
private static final YadisHtmlParser YADIS_HTML_PARSER
private static final java.lang.String XRDS_PARSER_CLASS_NAME_KEY
private static final XrdsParser XRDS_PARSER
private int _maxRedirects
private final HttpFetcher _httpFetcher
Constructor Detail |
---|
@Inject public YadisResolver(HttpFetcherFactory httpFetcherFactory)
public YadisResolver(HttpFetcher httpFetcher)
Method Detail |
---|
public int getMaxRedirects()
public void setMaxRedirects(int maxRedirects)
public java.util.List discoverRP(java.lang.String url) throws DiscoveryException
url
- RP's realm or return_to URL
DiscoveryException
public java.util.List discover(java.lang.String url) throws DiscoveryException
The maximum number of redirects that are followed is determined by the #_maxRedirects member field.
url
- YadisURL on which discovery will be performed
DiscoveryException
#discover(String, int, HttpCache)
public java.util.List discover(java.lang.String url, HttpFetcher httpFetcher) throws DiscoveryException
The maximum number of redirects that are followed is determined by the #_maxRedirects member field.
url
- YadisURL on which discovery will be performedhttpFetcher
- HttpFetcher
object to use for the call
DiscoveryException
#discover(String, int, HttpCache)
public java.util.List discover(java.lang.String url, int maxRedirects) throws DiscoveryException
url
- YadisURL on which discovery will be performedmaxRedirects
- The maximum number of redirects to be followed.
DiscoveryException
YadisResult
public java.util.List discover(java.lang.String url, int maxRedirects, HttpFetcher httpFetcher) throws DiscoveryException
url
- YadisURL on which discovery will be performedmaxRedirects
- The maximum number of redirects to be followed.httpFetcher
- HttpFetcher
object to use for the call.
DiscoveryException
YadisResult
public YadisResult discover(java.lang.String url, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
DiscoveryException
public YadisResult discover(java.lang.String url, int maxRedirects, HttpFetcher httpFetcher, java.util.Set serviceTypes) throws DiscoveryException
DiscoveryException
private void retrieveXrdsDocument(YadisResult result, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
result
- The YadisResult object containing a valid XRDS location.
It will be further populated with the Yadis discovery results.cache
- The HttpClient object to use for placing the callmaxRedirects
-
DiscoveryException
private java.lang.String getHtmlMeta(java.lang.String input) throws YadisException
input
- input data stream
YadisException
- on parsing errors or Yadis protocal violationsprivate YadisResult retrieveXrdsLocation(YadisUrl url, boolean useGet, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
The returned string should be validated before being used as a XRDS-Location URL.
cache
- HttpClient object to use for placing the callmaxRedirects
- url
- 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:
DiscoveryException
public HttpFetcher getHttpFetcher()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |