如何在CXF或jaxrs中配置Keep-Alive:客户端
问题描述:
我正在使用CXF和jaxrs:客户端连接到Restful服务。然而,300秒之后的安静服务超时 - 在他们的最后是DDOS缓解。根据Restful服务的所有者,如果我们在oyr请求中包含Keep-Alive头部,超时将不会发生。如何在CXF或jaxrs中配置Keep-Alive:客户端调用?提前如何在CXF或jaxrs中配置Keep-Alive:客户端
感谢
安格斯
答
您可以设置为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秒)
对不起,这没有奏效。任何其他想法的人? – angusrose
有可能您有额外的超时问题。检查更新的答案 – pedrofb
Hi @angusrose,你终于找到了配置超时的解决方案吗? – pedrofb