我有一个 http 请求,需要服务器处理太多时间(大约 5 分钟)。由于连接空闲 5 分钟,代理服务器关闭连接。我正在尝试在 Apache DefaultHttpClient 中使用 TCP Keep-Alive 使连接长时间处于活动状态(不要将 TCP Keep-Alive 与 HTTP Keep-Alive 混淆,后者在发送响应后根本不会关闭连接)。
Apache http 核心具有以下参数 SO_KEEPALIVE:http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/params/CoreConnectionPNames.html#SO_KEEPALIVE。但是,由于 DefaultHttpClient javadocs,我无法使用该参数自定义客户端的行为:https : //hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/DefaultHttpClient.html .
但是,我这样做了,似乎不起作用:
HttpClient client = getHttpClient();
client.getParams().setParameter(CoreConnectionPNames.SO_KEEPALIVE, true);
Run Code Online (Sandbox Code Playgroud)
你知道如何让 DefaultHttpClient 使用 TCP Keep-Alive 策略吗?
我正在将我的应用程序从maven转换为gradle,我正在寻找maven-release-plugin替代gradle.
我需要的插件是:
我想,最受欢迎的是Gradle Release Plugin(https://github.com/researchgate/gradle-release).它工作正常,但是,它将版本存储在单独的文件"gradle.properties"中.我需要将此版本存储在"build.gradle"文件中(就像pom.xml中的版本一样).
我还测试了以下插件,但它们也没有在build.gradle中存储版本:
是否有任何Gradle插件可以使用"build.gradle"文件中的版本?