You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Stankov. Yavor" <y....@seeburger.com> on 2025/06/02 14:33:39 UTC

Custom HttpRequestExecutor not working after update from httpclient 5.3.1 to 5.5

Hi,

I just update the version of the httpclient I'm using from 5.3.1 to 5.5 and my HTTP application totally stopped working.

When I check to see what is happening, I saw that my custom  HttpRequestExecutor is not being called anymore.

I'm relying on some custom logic in the execute method which is being executed before calling the super.execute, but the exec chain never gets inside of my HttpRequestExecutor. The method I'm overriding is -

    public ClassicHttpResponse execute(final ClassicHttpRequest request,
                                       final HttpClientConnection conn,
                                       final HttpContext context)

I tried to change from extending the HttpRequestExecutor, to implementing the newly introduced interface RequestExecutor (I think in version 5.4) but it didn't work either.

I'm registering the request executor by using the method: HttpClientBuilder.create().setRequestExecutor(new CustomHttpRequestExecutor())

I have no other changes made in my application, the only change is the update to the new version.

Can you please help me with this one!

Best Regards,
Yavor


RE: Custom HttpRequestExecutor not working after update from httpclient 5.3.1 to 5.5

Posted by "Stankov. Yavor" <y....@seeburger.com>.
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 <ht...@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-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Custom HttpRequestExecutor not working after update from httpclient 5.3.1 to 5.5

Posted by Oleg Kalnichevski <ol...@apache.org>.
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-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Custom HttpRequestExecutor not working after update from httpclient 5.3.1 to 5.5

Posted by "Stankov. Yavor" <y....@seeburger.com>.
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.

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?

Best Regards,
Yavor


-----Original Message-----
From: Oleg Kalnichevski <ol...@apache.org> 
Sent: Monday, June 2, 2025 5:57 PM
To: HttpClient User Discussion <ht...@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 14:33 +0000, Stankov. Yavor wrote:
> Hi,
> 
> I just update the version of the httpclient I'm using from 5.3.1 to
> 5.5 and my HTTP application totally stopped working.
> 
> When I check to see what is happening, I saw that my custom 
> HttpRequestExecutor is not being called anymore.
> 
> I'm relying on some custom logic in the execute method which is being 
> executed before calling the super.execute, but the exec chain never 
> gets inside of my HttpRequestExecutor. The method I'm overriding is -
> 
>     public ClassicHttpResponse execute(final ClassicHttpRequest 
> request,
>                                        final HttpClientConnection 
> conn,
>                                        final HttpContext context)
> 
> I tried to change from extending the HttpRequestExecutor, to 
> implementing the newly introduced interface RequestExecutor (I think 
> in version 5.4) but it didn't work either.
> 
> I'm registering the request executor by using the method:
> HttpClientBuilder.create().setRequestExecutor(new
> CustomHttpRequestExecutor())
> 
> I have no other changes made in my application, the only change is the 
> update to the new version.
> 
> Can you please help me with this one!
> 
> Best Regards,
> Yavor
> 

Hi Yavor

I double-checked HttpClientBuilder code and found no obvious regressions there. 

Please provide a test case reproducing the problem and I will investigate further.

Oleg

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


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


Re: Custom HttpRequestExecutor not working after update from httpclient 5.3.1 to 5.5

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2025-06-02 at 14:33 +0000, Stankov. Yavor wrote:
> Hi,
> 
> I just update the version of the httpclient I'm using from 5.3.1 to
> 5.5 and my HTTP application totally stopped working.
> 
> When I check to see what is happening, I saw that my custom 
> HttpRequestExecutor is not being called anymore.
> 
> I'm relying on some custom logic in the execute method which is being
> executed before calling the super.execute, but the exec chain never
> gets inside of my HttpRequestExecutor. The method I'm overriding is -
> 
>     public ClassicHttpResponse execute(final ClassicHttpRequest
> request,
>                                        final HttpClientConnection
> conn,
>                                        final HttpContext context)
> 
> I tried to change from extending the HttpRequestExecutor, to
> implementing the newly introduced interface RequestExecutor (I think
> in version 5.4) but it didn't work either.
> 
> I'm registering the request executor by using the method:
> HttpClientBuilder.create().setRequestExecutor(new
> CustomHttpRequestExecutor())
> 
> I have no other changes made in my application, the only change is
> the update to the new version.
> 
> Can you please help me with this one!
> 
> Best Regards,
> Yavor
> 

Hi Yavor

I double-checked HttpClientBuilder code and found no obvious
regressions there. 

Please provide a test case reproducing the problem and I will
investigate further.

Oleg

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