本文整理汇总了Java中org.openid4java.OpenIDException.YADIS_GET_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java OpenIDException.YADIS_GET_ERROR属性的具体用法?Java OpenIDException.YADIS_GET_ERROR怎么用?Java OpenIDException.YADIS_GET_ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openid4java.OpenIDException
的用法示例。
在下文中一共展示了OpenIDException.YADIS_GET_ERROR属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveXrdsDocument
/**
* Tries to retrieve the XRDS document via a GET call on XRDS location
* provided in the result parameter.
*
* @param result The YadisResult object containing a valid XRDS location.
* It will be further populated with the Yadis discovery results.
* @param cache The HttpClient object to use for placing the call
* @param maxRedirects
*/
private void retrieveXrdsDocument(YadisResult result, int maxRedirects, Set serviceTypes)
throws DiscoveryException {
_httpFetcher.getRequestOptions().setMaxRedirects(maxRedirects);
try {
HttpResponse resp = _httpFetcher.get(result.getXrdsLocation().toString());
if (resp == null || HttpStatus.SC_OK != resp.getStatusCode())
throw new YadisException("GET failed on " + result.getXrdsLocation(),
OpenIDException.YADIS_GET_ERROR);
// update xrds location, in case redirects were followed
result.setXrdsLocation(resp.getFinalUri(), OpenIDException.YADIS_GET_INVALID_RESPONSE);
Header contentType = resp.getResponseHeader("content-type");
if ( contentType != null && contentType.getValue() != null)
result.setContentType(contentType.getValue());
if (resp.isBodySizeExceeded())
throw new YadisException(
"More than " + _httpFetcher.getRequestOptions().getMaxBodySize() +
" bytes in HTTP response body from " + result.getXrdsLocation(),
OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
} catch (IOException e) {
throw new YadisException("Fatal transport error: " + e.getMessage(),
OpenIDException.YADIS_GET_TRANSPORT_ERROR, e);
}
}