Bob Lee wrote:
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


Hi Bob

I _really_, _really_ like this idea. However, what shall HttpClient do if it gets status code other than 200? Throw an exception? Ignore the status code?

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to