hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Apache CloseableHttpAsyncClient - way to access HttpContext in a callback method?
Date Fri, 22 Nov 2013 12:37:13 GMT
On Fri, 2013-11-22 at 14:27 +0200, Petteri Hentilä wrote:
> A couple of comments.
> 1. I cannot pass the HttpContext to FutureCallback as a construction
> parameter, because that class has only one parameterless constructor. I
> also cannot put the HttpContext as the generic type for FutureCallback
> because it gives me a compile error.

FutureCallback is an _interface_. One can have any constructor
parameters for a class that implements this interface.

> 2. I derived my own class from BasicAsyncResponseConsumer to have more
> control over the response processing, but that class does not have the
> correct methods that I would need. It has a method
> responseReceived(HttpResponse) but it does not get HttpContext as a
> parameter. It also has a method failed(Exception) but it does not get
> HttpContext as a parameter either.

Same deal as with FutureCallback. You can pass any additional contextual
parameters at the construction time.


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

View raw message