List of usage examples for org.apache.http.impl.nio.client CloseableHttpPipeliningClient execute
@Override public Future<List<HttpResponse>> execute(final HttpHost target, final List<HttpRequest> requests, final FutureCallback<List<HttpResponse>> callback)
From source file:com.boonya.http.async.examples.nio.client.AsyncClientPipelined.java
public static void main(final String[] args) throws Exception { CloseableHttpPipeliningClient httpclient = HttpAsyncClients.createPipelining(); try {//from w w w .jav a 2 s . c o m httpclient.start(); HttpHost targetHost = new HttpHost("localhost", 8080); HttpGet[] resquests = { new HttpGet("/docs/index.html"), new HttpGet("/docs/introduction.html"), new HttpGet("/docs/setup.html"), new HttpGet("/docs/config/index.html") }; Future<List<HttpResponse>> future = httpclient.execute(targetHost, Arrays.<HttpRequest>asList(resquests), null); List<HttpResponse> responses = future.get(); System.out.println(responses); System.out.println("Shutting down"); } finally { httpclient.close(); } System.out.println("Done"); }
From source file:httpasync.AsyncClientPipelined.java
public static void main(final String[] args) throws Exception { CloseableHttpPipeliningClient httpclient = HttpAsyncClients.createPipelining(); try {/*from www .j a va 2 s .co m*/ httpclient.start(); HttpHost targetHost = new HttpHost("money.moneydj.com", 80); HttpGet[] resquests = { new HttpGet("/us/basic/basic0001/Person"), new HttpGet("/us/basic/basic0001/AA"), new HttpGet("/us/basic/basic0001/PSG"), // new HttpGet("/docs/introduction.html"), // new HttpGet("/docs/setup.html"), // new HttpGet("/docs/config/index.html") }; Future<List<HttpResponse>> future = httpclient.execute(targetHost, Arrays.<HttpRequest>asList(resquests), null); List<HttpResponse> responses = future.get(); responses.forEach(System.out::println); System.out.println("Shutting down"); } finally { httpclient.close(); } System.out.println("Done"); }