Reputation: 1578
I have a JAX-RS client in CXF created via JAXRSClientFactoryBean.create. How can I set the connection/receive timeouts?
I assume I need to get hold of the conduit but can't work out how to. This project is not using Spring.
Upvotes: 6
Views: 6289
Reputation: 1578
HTTPClientPolicy clientConfig = WebClient.getConfig(service).getHttpConduit().getClient();
clientConfig.setReceiveTimeout(10000);
Upvotes: 1
Reputation: 1274
Here's the code I use:
service = JAXRSClientFactory.create(url, serviceClass, providers);
HTTPConduit conduit = WebClient.getConfig(service).getHttpConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(300000); //5 minutes
conduit.setClient(policy);
Upvotes: 6