hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Response handler API; was Re: Can we make it easier to release resources?
Date Fri, 27 Jun 2008 23:43:56 GMT
On Fri, 2008-06-20 at 11:50 -0700, Bob Lee wrote:

...

> 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

Folks,

I added support for response handlers as suggested by Bob. Here's the
example of the new API

http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java

I think it turned out pretty neat.

Bob, please review.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message