我HttpClient 4.0
用来从远程主机获取一些 XML。当我使用诸如https://user:pwd@www.somesite.com之类的 URL 时,它在浏览器中运行良好,但在 HttpClient 中使用此堆栈跟踪失败(如下)。有什么建议么?我正在使用SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER
while 设置ThreadSafeClientConnManager
来处理 HTTPS 请求
代码(部分):
final HttpGet get= new HttpGet(url);
final HttpResponse response = this.client.execute(get);
return new BasicResponseHandler().handleResponse(response);
堆栈跟踪:
01-05 22:34:03.783: ERROR/SearchResults(11565):
Failed to process request to URL:
https://user:pwd@www.somesite.com/products/foo/meta/xml_proper_encoding.jsp?version=1
01-05 22:34:03.783: ERROR/SearchResults(11565):
org.apache.http.client.HttpResponseException: Unauthorized