1
我使用HttpClient 4.0
從遠程主機獲取一些XML。當我使用URL(如https://user:[email protected])時,它在瀏覽器中正常工作,但在此堆棧跟蹤的HttpClient中失敗(如下所示)。有什麼建議麼?我使用SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER
同時設定ThreadSafeClientConnManager
處理HTTPS請求驗證在HttpClient中失敗,但在瀏覽器中沒有問題
代碼(部分):
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:[email protected]/products/foo/meta/xml_proper_encoding.jsp?version=1
01-05 22:34:03.783: ERROR/SearchResults(11565):
org.apache.http.client.HttpResponseException: Unauthorized
完美!非常感謝你! – Bostone 2010-01-06 17:03:05