Apache HttpClient имеет интерфейс HttpResponseInterceptor с этим методом.
void process(HttpResponse response, HttpContext context)
Как получить экземпляр HttpRequest, который привел к этому экземпляру HttpResponse?
HttpClients.custom()
.addInterceptorLast((HttpResponseInterceptor)(response, context) -> {
// how to get matching request?
})
.build();