I'm new to Java NIO. I'm using it to make HTTP Get requests. The requests executes properly, but I am unable to figure out how to get the content of the response.
For example,
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
httpClient.start();
url = buildUrl(); //builds the url for the GET request
BasicAsyncResponseConsumer consumer = new BasicAsyncResponseConsumer();
Future<HttpResponse> future = httpClient.execute(HttpAsyncMethods.createGet(url), consumer, null)
Now how do I get the content of the response? On printing future, I get the following:
HTTP/1.1 200 OK [Content-Type: application/json, Date: Fri, 24 Jun 2016 20:21:47 GMT, Content-Length: 903, Connection: keep-alive] [Content-Length: 903,Chunked: false]
My response (on the browser) is 903 characters, so I know the it makes the request correctly. However, how do I print out the json content of the result?