我必须根据请求中的某些条件在 Apache cxf 请求中设置不同的超时时间
我现在的代码是这样的
<http-conf:client ReceiveTimeout="120000" AcceptEncoding="gzip, deflate"/>
现在有什么方法可以根据某些条件更改特定请求的接收超时。
最佳答案
目前我们在CXF中没有提供这种设置。 如果您仍想这样做,您可以从 CXF 客户端代理获取 HttpConduit,并将 HTTPClientPolicy 直接设置为 HttpConduit。
// Get the HttpConduit
HttpConduit httpConduit = (HttpConduit) ClientProxy.getClient(greeter).getConduit();
// Set your custom HTTPClientPolicy directly to the httpConduit
httpConduit.setHTTPClientPolicy(httpClientPolicy);
通过这种方式,您可以在向服务器发送请求之前更新超时。
关于java - 更改 Apache CXF 中特定请求的客户端超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21979933/