Review of new Http client API (original) (raw)

Michael McMahon michael.x.mcmahon at oracle.com
Wed Aug 22 13:05:01 PDT 2012


On 22/08/12 15:29, Chris Hegarty wrote:

Michael what you have looks good.

But, I think what Sam is suggesting ( or maybe not, but I like it ;-) ), is something like this. (I'd need to think more about what effect this has on the different modes, async/blocking ) class HttpResponse { HttpResponse onHeaders(Block); HttpResponse onError(BiBlock<HttpResponse,Throwable>); HttpResponse onBodyPart(BiBlock<HttpResponse,ByteBuffer>); } Right. I see what you mean in terms of making the setting of the callbacks fluent. I assume that Block and BiBlock are types associated with Lambda somehow, but otherwise this is unfamiliar territory to me .... response.onHeaders(r -> headers(r)) .onError((r,t) -> error(t)) .onBodyPart((r,bb) -> body(r, bb)); So, headers() and body() would be methods on HttpResponse ... Right ? What is error()?



More information about the net-dev mailing list