HTTP异步客户端HttpAsyncClient

2018-06-09  本文已影响524人  无量散人
/**
 * 此接口只代表HTTP请求执行的最基本的契约。它对请求执行过程不施
 * 加任何限制或特定细节,并将状态管理、身份验证和重定向处理的细节
 * 留给子类实现。
 */
public interface HttpAsyncClient {

    /**
     * 使用给定上下文启动异步HTTP请求execution。
     */
    <T> Future<T> execute(
            HttpAsyncRequestProducer requestProducer,
            HttpAsyncResponseConsumer<T> responseConsumer,
            HttpContext context,
            FutureCallback<T> callback);

    /**
     * 使用默认上下文启动异步HTTP请求execution
     */
    <T> Future<T> execute(
            HttpAsyncRequestProducer requestProducer,
            HttpAsyncResponseConsumer<T> responseConsumer,
            FutureCallback<T> callback);

    /**
     * 启动给定目标的异步HTTP请求execution(指定上线文)
     */
    Future<HttpResponse> execute(
            HttpHost target, HttpRequest request, HttpContext context,
            FutureCallback<HttpResponse> callback);

    /**
     * 启动给定目标的异步HTTP请求execution
     */
    Future<HttpResponse> execute(
            HttpHost target, HttpRequest request,
            FutureCallback<HttpResponse> callback);

    /**
     * 使用给定上下文启动异步HTTP请求execution
     */
    Future<HttpResponse> execute(
            HttpUriRequest request, HttpContext context,
            FutureCallback<HttpResponse> callback);

    /**
     * 启动异步HTTP请求execution
     */
    Future<HttpResponse> execute(
            HttpUriRequest request,
            FutureCallback<HttpResponse> callback);

}

MinimalHttpAsyncClient继承关系图.png
上一篇下一篇

猜你喜欢

热点阅读