2016-07-08 130 views
0

我正在使用CXF和jaxrs:客户端连接到Restful服务。然而,300秒之后的安静服务超时 - 在他们的最后是DDOS缓解。根据Restful服务的所有者,如果我们在oyr请求中包含Keep-Alive头部,超时将不会发生。如何在CXF或jaxrs中配置Keep-Alive:客户端调用?提前如何在CXF或jaxrs中配置Keep-Alive:客户端

感谢

安格斯

回答

0

您可以设置为jaxrs:client头usign的jaxrs:headers标签

<jaxrs:client id="" serviceClass="" address="" inheritHeaders="true"> 
     <jaxrs:headers> 
      <entry key="Connection" value="keep-alive"/> 
     </jaxrs:headers> 
</jaxrs:client> 

您也可以在http:conduit元素的http-conf:client标签配置超时

<http-conf:conduit name="*"> 
    <http-conf:client Connection="Keep-Alive" 
         ConnectionTimeout="0" 
         ReceiveTimeout="0" /> 
</http-conf:conduit> 

参数的完整列表是here。 请注意,keep-alive是默认值。 ReceiveTimeout 表示没有超时。默认值是30000(30秒)

+0

对不起,这没有奏效。任何其他想法的人? – angusrose

+0

有可能您有额外的超时问题。检查更新的答案 – pedrofb

+0

Hi @angusrose,你终于找到了配置超时的解决方案吗? – pedrofb