public interface HttpClient
| Modifier and Type | Method and Description |
|---|---|
HttpResponse |
execute(HttpHost target, HttpRequest request)
使用默认上下文执行HTTP请求。
|
HttpResponse |
execute(HttpHost target, HttpRequest request, HttpContext context)
使用给定的上下文执行HTTP请求。
|
<T> T |
execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler)
使用默认上下文对目标执行HTTP请求,并使用给定的响应处理程序处理响应。
|
<T> T |
execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context)
使用给定的上下文对目标执行HTTP请求,并使用给定的响应处理程序处理响应。
|
HttpResponse |
execute(HttpUriRequest request)
使用默认上下文执行HTTP请求。
|
HttpResponse |
execute(HttpUriRequest request, HttpContext context)
使用给定的上下文执行HTTP请求。
|
<T> T |
execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler)
使用默认上下文执行HTTP请求,并使用给定的响应处理程序处理响应。
|
<T> T |
execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context)
使用给定的上下文执行HTTP请求,并使用给定的响应处理程序处理响应。
|
ClientConnectionManager |
getConnectionManager()
已过时。
(4.3)使用
HttpClientBuilder 。
|
HttpParams |
getParams()
已过时。
(4.3)使用
RequestConfig 。
|
@Deprecated HttpParams getParams()
RequestConfig 。
@Deprecated ClientConnectionManager getConnectionManager()
HttpClientBuilder 。
HttpResponse execute(HttpUriRequest request) throws IOException, ClientProtocolException
request - 请求执行
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
HttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException, ClientProtocolException
request - 请求执行
context - 用于执行的上下文,或
null使用默认上下文
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
HttpResponse execute(HttpHost target, HttpRequest request) throws IOException, ClientProtocolException
target - 请求的目标主机。
如果他们仍然可以确定路由,例如到默认目标或通过检查请求,则实施方案可以接受null 。
request - 请求执行
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) throws IOException, ClientProtocolException
target - 请求的目标主机。
如果他们仍然可以确定路由,例如到默认目标或通过检查请求,那么实现可以接受null 。
request - 请求执行
context - 用于执行的上下文,或
null使用默认上下文
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
<T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException
需要实现类以确保与响应相关联的内容实体完全消耗,并且底层连接在所有情况下自动释放回连接管理器,从而减轻个人ResponseHandler在内部管理资源释放的情况。
request - 执行请求
responseHandler - 响应处理程序
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
<T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context) throws IOException, ClientProtocolException
需要实现类,以确保与响应相关联的内容实体完全消耗,并且底层连接在所有情况下自动释放回连接管理器,从而减轻个人ResponseHandler不必在内部管理资源释放。
request - 要执行的请求
responseHandler - 响应处理程序
context - 用于执行的上下文,或
null使用默认上下文
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
<T> T execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException
需要实现类,以确保与响应相关联的内容实体完全消耗,并且底层连接在所有情况下自动释放回连接管理器, 以免个人ResponseHandler不必在内部管理资源释放。
target - 请求的目标主机。
如果他们仍然可以确定路由,例如到默认目标或通过检查请求,则实施方案可以接受null 。
request - 执行请求
responseHandler - 响应处理程序
IOException - 出现问题或连接中止时
ClientProtocolException - 在http协议错误的情况下
<T> T execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context) throws IOException, ClientProtocolException
需要实现类以确保与响应相关联的内容实体被完全消耗,并且底层连接在所有情况下都自动释放回连接管理器,从而使个人ResponseHandler不必在内部管理资源释放。
target - 请求的目标主机。
如果他们仍然可以确定路由,例如到默认目标或通过检查请求,那么实现可以接受null 。
request - 要执行的请求
responseHandler - 响应处理程序
context - 用于执行的上下文,或
null使用默认上下文
IOException - 出现问题或连接中止时
ClientProtocolException - in case of an http protocol error
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.