当前位置: 首页>>代码示例>>Java>>正文


Java OpenIDException.YADIS_GET_ERROR属性代码示例

本文整理汇总了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);
    }
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:40,代码来源:YadisResolver.java


注:本文中的org.openid4java.OpenIDException.YADIS_GET_ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。