Hi Oleg,

Thank you very much for the help!

I solved the problem. The reason was that there are two overloading execute 
methods in the HttpRequestExecutor - one with and one without 
HttpResponseInformationCallback as a parameter.

I have overridden the one without the HttpResponseInformationCallback which is 
not invoked anymore, but instead the logic which you sent to me 
(https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java#L233)
 is calling the other one.

Now I switched to overriding the method with HttpResponseInformationCallback 
parameter and everything works just fine.

Thanks once again!

Best Regards,
Yavor


-----Original Message-----
From: Oleg Kalnichevski <ol...@apache.org> 
Sent: Monday, June 2, 2025 6:29 PM
To: HttpClient User Discussion <httpclient-users@hc.apache.org>
Subject: Re: Custom HttpRequestExecutor not working after update from 
httpclient 5.3.1 to 5.5

On Mon, 2025-06-02 at 15:12 +0000, Stankov. Yavor wrote:
> Hi Oleg,
> 
> Thank you very much for the quick response! Having in mind the 
> context, I'm not really sure how I can provide the a way for you to 
> test this.
> 

The problem is I cannot fix something I am not able to reproduce locally.  


> However if this helps a bit, before the update, my request executor 
> was being invoked by the 
> PoolingHttpClientConnectionManager$InternalConnectionEndpoint and to 
> be more precise from the method:
> 
>         /**
>          * @deprecated Use {@link #execute(String, ClassicHttpRequest, 
> RequestExecutor, HttpContext)}
>          */
>         @Deprecated
>         @Override
>         public ClassicHttpResponse execute(
>                 final String exchangeId,
>                 final ClassicHttpRequest request,
>                 final HttpRequestExecutor requestExecutor,
>                 final HttpContext context)
> 
> Which it looks like is already deprecated and it is recommended to use 
> the new method with the RequestExecutor instead. So, I'm wondering if 
> it's possible that the old one is never called anymore, which will 
> mean that there is no way for the execution to get inside of my 
> HttpRequestExecutor anymore and I need to create a RequestExecutor 
> instead. However the setter of the HttpClientBuilder accepts only 
> HttpRequestExecutor, so what will be the appropriate way to introduce 
> such custom RequestExecutor?
> 

If everything got wired correctly the default implementation of RequestExecutor 
will merely delegate the request execution to your custom HttpRequestExecutor

https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java#L233

Hope this helps

Oleg


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

Reply via email to