[英]Digest authentication using HttpURLConnection
我在GAE上托管我的Java应用程序。 我必须下载一些外部RSS页面并进行解析。 问题是外部站点需要摘要身份验证。 有什么方法可以使用HttpURLConnection类进行摘要身份验证。 我无法使用HTTPClient,因为GAE JRE白名单中未提及HTTPClient
预先感谢您的任何帮助
看看这个包装纸; 它允许在Google App Engine上使用Java HttpClient 。
更多信息在这里 。
您还可以使用Jersey-Client ,它与gae兼容并且比HttpClient容易得多:
WebResource resource = Client.create().resource("http/../uri");
resource.addFilter(new HTTPDigestAuthFilter(login, password));
ClientResponse response = resource.get(ClientResponse.class);
assertTrue(response.getStatus() == 200);
assertNotNull(response.getEntity(String.class));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.