try
{
HttpResponse resp = _httpFetcher.get(hxri);
if (resp == null || HttpStatus.SC_OK != resp.getStatusCode())
throw new DiscoveryException("Error retrieving HXRI: " + hxri);
Set targetTypes = DiscoveryInformation.OPENID_OP_TYPES;
List endpoints = XRDS_PARSER.parseXrds(resp.getBody(), targetTypes);
List results = new ArrayList();
Iterator endpointIter = endpoints.iterator();
while (endpointIter.hasNext())
{
XrdsServiceEndpoint endpoint = (XrdsServiceEndpoint) endpointIter.next();
Iterator typesIter = endpoint.getTypes().iterator();
while (typesIter.hasNext()) {
String type = (String) typesIter.next();
if (!targetTypes.contains(type)) continue;
try {
results.add(new DiscoveryInformation(
new URL(endpoint.getUri()),
parseIdentifier(endpoint.getCanonicalId()),
DiscoveryInformation.OPENID2.equals(type) ? endpoint.getLocalId() :
DiscoveryInformation.OPENID1_SIGNON_TYPES.contains(type) ? endpoint.getDelegate() : null,
type));
} catch (MalformedURLException e) {
throw new DiscoveryException("Invalid endpoint URL discovered: " + endpoint.getUri());
}
}
}
return results;
}
catch (IOException e)
{
throw new DiscoveryException("Error performing discovery on HXRI: " + hxri);
}
}