hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petteri Hentilä <petteri.hent...@gmail.com>
Subject Apache CloseableHttpAsyncClient - way to access HttpContext in a callback method?
Date Fri, 22 Nov 2013 08:55:53 GMT

I'm creating my own asynchronous HTTP client with for performance testing
purposes. I am thinking of using Apache's CloseableHttpAsyncClient for this.

Here is an example how to use this client:

With CloseableHttpAsyncClient there are three callback methods completed(),
failed() and cancelled(). The completed() -method gets the HttpResponse as
a parameter and the failed() -method gets the Exception as the parameter.

However, I would also need an access to the HttpContext object in all of
these callbacks methods. HttpContext represents execution state of an HTTP
process. You can for example store any user related objects to HttpContext.

Basically what I need is to have an access to HttpContext at least in the
following three different situations: 1. When the Http response is fully
received 2. When an exception occurs (for example the target host is down)
3. When a connection timeout occurs

Does anyone know a way to achieve this?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message