Right now, we have to do something like this:
HttpResponse r = client.execute(...)
try {
...
} finally {
HttpEntity e = r.getEntity();
if (e != null) {
// Soon to be renamed finish()
e.consumeContent();
}
}
It might be nice if we could do something like this:
HttpResponse r = client.execute(...)
try {
...
} finally {
response.finish();
}
Or even something like this:
public interface ResponseHandler<T> {
T handle(HttpResponse response) throws IOException;
}
String result = client.execute(myHandler);
Then you could have a few reusable response handlers, like a JSON handler,
and XML handler, etc.
Bob