How to set timeout to JAX-RS client with CXF

后端 未结 3 1165
死守一世寂寞
死守一世寂寞 2021-01-08 00:26

I am working on a Rest Client and I am using CXF with JAX-RS.

The problem that I have is that I cannot find any way to override th

3条回答
  •  半阙折子戏
    2021-01-08 00:56

    You can try something like this:

    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(30000);
    http.setClient(httpClientPolicy);
    

    see http://cxf.apache.org/javadoc/latest/org/apache/cxf/transports/http/configuration/HTTPClientPolicy.html

提交回复
热议问题