Java 类org.apache.http.nio.client.HttpAsyncClient 实例源码

项目:lams    文件:HttpComponentsAsyncClientHttpRequestFactory.java   
@Override
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException {
    HttpAsyncClient asyncClient = getHttpAsyncClient();
    startAsyncClient();
    HttpUriRequest httpRequest = createHttpUriRequest(httpMethod, uri);
    postProcessHttpRequest(httpRequest);
       HttpContext context = createHttpContext(httpMethod, uri);
       if (context == null) {
           context = HttpClientContext.create();
       }
       // Request configuration not set in the context
       if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
           // Use request configuration given by the user, when available
           RequestConfig config = null;
           if (httpRequest instanceof Configurable) {
               config = ((Configurable) httpRequest).getConfig();
           }
           if (config == null) {
               config = RequestConfig.DEFAULT;
           }
           context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
       }
    return new HttpComponentsAsyncClientHttpRequest(asyncClient, httpRequest, context);
}
项目:spring4-understanding    文件:HttpComponentsAsyncClientHttpRequestFactory.java   
@Override
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException {
    HttpAsyncClient asyncClient = getHttpAsyncClient();
    startAsyncClient();
    HttpUriRequest httpRequest = createHttpUriRequest(httpMethod, uri);
    postProcessHttpRequest(httpRequest);
       HttpContext context = createHttpContext(httpMethod, uri);
       if (context == null) {
           context = HttpClientContext.create();
       }
    // Request configuration not set in the context
    if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
        // Use request configuration given by the user, when available
        RequestConfig config = null;
        if (httpRequest instanceof Configurable) {
            config = ((Configurable) httpRequest).getConfig();
        }
        if (config == null) {
            config = createRequestConfig(asyncClient);
        }
        if (config != null) {
            context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
        }
    }
    return new HttpComponentsAsyncClientHttpRequest(asyncClient, httpRequest, context);
}
项目:epigraph    文件:AbstractRemoteOperationInvocation.java   
protected AbstractRemoteOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull OD operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset,
    final int okStatusCode) {

  this.host = host;
  this.httpClient = httpClient;
  this.resourceName = resourceName;
  this.operationDeclaration = operationDeclaration;
  this.serverProtocol = serverProtocol;
  this.charset = charset;
  this.okStatusCode = okStatusCode;
}
项目:epigraph    文件:RemoteCustomOperationInvocation.java   
public RemoteCustomOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull CustomOperationDeclaration operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset) {
  super(host, httpClient, resourceName, operationDeclaration, serverProtocol, charset, HttpStatusCode.OK);
}
项目:epigraph    文件:RemoteReadOperationInvocation.java   
public RemoteReadOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull ReadOperationDeclaration operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset) {

  super(host, httpClient, resourceName, operationDeclaration, serverProtocol, charset, HttpStatusCode.OK);
}
项目:epigraph    文件:RemoteUpdateOperationInvocation.java   
public RemoteUpdateOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull UpdateOperationDeclaration operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset) {
  super(host, httpClient, resourceName, operationDeclaration, serverProtocol, charset, HttpStatusCode.OK);
}
项目:epigraph    文件:RemoteDeleteOperationInvocation.java   
public RemoteDeleteOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull DeleteOperationDeclaration operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset) {

  super(host, httpClient, resourceName, operationDeclaration, serverProtocol, charset, HttpStatusCode.OK);
}
项目:epigraph    文件:RemoteCreateOperationInvocation.java   
public RemoteCreateOperationInvocation(
    final @NotNull HttpHost host,
    final @NotNull HttpAsyncClient httpClient,
    final @NotNull String resourceName,
    final @NotNull CreateOperationDeclaration operationDeclaration,
    final @NotNull ServerProtocol serverProtocol,
    final @NotNull Charset charset) {
  super(host, httpClient, resourceName, operationDeclaration, serverProtocol, charset, HttpStatusCode.CREATED);
}
项目:debop4j    文件:AsyncLoadPage.java   
@Override
public void run() {
    // To change body of implemented methods use File | Settings | File Templates.if (log.isDebugEnabled())
    log.debug("URI=[{}] 의 웹 컨텐츠를 비동기 방식으로 다운로드 받아 캐시합니다.", url);

    try {

        String responseStr;
        HttpAsyncClient httpClient = new DefaultHttpAsyncClient();
        httpClient.start();
        HttpGet request = new HttpGet(url);
        Future<HttpResponse> future = httpClient.execute(request, null);

        HttpResponse response = future.get();
        responseStr = EntityUtils.toString(response.getEntity(), Charsets.UTF_8.toString());
        httpClient.shutdown();

        if (log.isDebugEnabled())
            log.debug("URI=[{}]로부터 웹 컨텐츠를 다운로드 받았습니다. responseStr=[{}]",
                      url, StringTool.ellipsisChar(responseStr, 255));

        ctx.getResponse().setCharacterEncoding("UTF-8");
        PrintWriter writer = ctx.getResponse().getWriter();
        writer.write(responseStr);
        writer.close();
        ctx.complete();
    } catch (Exception ignored) {
        throw new RuntimeException(ignored);
    }
}
项目:lams    文件:HttpComponentsAsyncClientHttpRequest.java   
HttpComponentsAsyncClientHttpRequest(HttpAsyncClient httpClient, HttpUriRequest httpRequest, HttpContext httpContext) {
    this.httpClient = httpClient;
    this.httpRequest = httpRequest;
    this.httpContext = httpContext;
}
项目:http-agent    文件:AgentServlet.java   
protected HttpAsyncClient getProxyClientAsync() {
    return httpClient;
}
项目:java-api-client    文件:DefaultClient.java   
public DefaultClient(HttpAsyncClient client, ClientConfig config) {
    this.client = client;
    this.config = config;
}
项目:java-api-client    文件:DefaultClient.java   
public HttpAsyncClient getClient() {
    return client;
}
项目:yunpian-java-sdk    文件:YunpianClient.java   
public HttpAsyncClient http() {
    return clnt;
}
项目:spring4-understanding    文件:HttpComponentsAsyncClientHttpRequest.java   
HttpComponentsAsyncClientHttpRequest(HttpAsyncClient httpClient, HttpUriRequest httpRequest, HttpContext httpContext) {
    this.httpClient = httpClient;
    this.httpRequest = httpRequest;
    this.httpContext = httpContext;
}
项目:clickstream-rest-proxy    文件:AbstractClient.java   
public AbstractClient(String baseUri, HttpAsyncClient httpClient) throws URISyntaxException {
    this(new URI(baseUri), httpClient);
}
项目:clickstream-rest-proxy    文件:AbstractClient.java   
public AbstractClient(URI baseUri, HttpAsyncClient httpClient) {
    this.baseUri = baseUri;
    this.httpClient = httpClient;
}
项目:clickstream-rest-proxy    文件:Consumer.java   
public Consumer(String consumers, HttpAsyncClient httpClient) throws URISyntaxException {
    super(consumers, httpClient);
}
项目:clickstream-rest-proxy    文件:Consumer.java   
public Consumer(URI consumers, HttpAsyncClient httpClient) {
    super(consumers, httpClient);
}
项目:clickstream-rest-proxy    文件:Producer.java   
public Producer(String topics, HttpAsyncClient httpClient) throws URISyntaxException {
    super(topics, httpClient);
}
项目:clickstream-rest-proxy    文件:Producer.java   
public Producer(URI topics, HttpAsyncClient httpClient) {
    super(topics, httpClient);
}
项目:hystrix-monitor    文件:HystrixMonitor.java   
@Autowired
public HystrixMonitor(HttpAsyncClient httpAsyncClient, MonitoringSystem monitoringSystem) {
    this.httpAsyncClient = httpAsyncClient;
    this.monitoringSystem = monitoringSystem;
}
项目:relution-jenkins-plugin    文件:ZeroCopyFileRequest.java   
@Override
public Future<HttpResponse> execute(final HttpAsyncClient httpClient) throws FileNotFoundException {
    final HttpAsyncResponseConsumer<HttpResponse> consumer = new BasicAsyncResponseConsumer();
    final HttpAsyncRequestProducer producer = this.getProducer();
    return httpClient.execute(producer, consumer, null);
}
项目:relution-jenkins-plugin    文件:EntityRequest.java   
@Override
public Future<HttpResponse> execute(final HttpAsyncClient httpClient) {

    final HttpUriRequest request = this.createRequest();
    return httpClient.execute(request, null);
}
项目:relution-jenkins-plugin    文件:ApiRequest.java   
Future<HttpResponse> execute(HttpAsyncClient httpClient) throws IOException;