Changing client timeout for a specific request in Apache CXF

I need to set a different timeout in an Apache cxf request based on some condition in my request

my current code is as follows

 <http-conf:client  ReceiveTimeout="120000" AcceptEncoding="gzip, deflate"/>

Now there is a way to change this receive timeout for a specific request based on some condition.

+3
source share
1 answer

Current, we do not provide this type of setup in CXF. If you still want to do this, you can get HttpConduit from the CXF proxy and set HTTPClientPolicy directly to HttpConduit.

 // Get the HttpConduit 
 HttpConduit httpConduit = (HttpConduit) ClientProxy.getClient(greeter).getConduit();
 // Set your custom HTTPClientPolicy directly to the httpConduit
 httpConduit.setHTTPClientPolicy(httpClientPolicy);

Thus, you can update the timeout before sending a request to the server.

+2
source

All Articles