In the example below from Jetty's docs, a simple method of performing an efficient, asynchronous HTTP request is described. However, it never specifies how you are actually supposed to retrieve the server's reply in this example, and I can't seem to figure it out.
The Result object has getResponse() and getRequest(), but neither of these has methods to access content.
Anyone know?
Jetty's docs
A simple asynchronous GET request can be written in this way:
httpClient.newRequest("http://domain.com/path")
.send(new Response.CompleteListener()
{
@Override
public void onComplete(Result result)
{
// Your logic here
}
});
Method Request.send(Response.CompleteListener) returns void and does not block; the Response.CompleteListener provided as a parameter is notified when the request/response conversation is complete, and the Result parameter allows you to access the response object.