| 异常 | 描述 |
|---|---|
| TunnelRefusedException | Deprecated
(4.3)保留供内部使用。
|
通常的执行流程可以通过下面的代码段来演示:
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpGet httpGet = new HttpGet("http://targethost/homepage");
CloseableHttpResponse response = httpclient.execute(httpGet);
try {
System.out.println(response.getStatusLine());
HttpEntity entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
EntityUtils.consume(entity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.