Disable Keep Alive in Apache HttpClient

爷,独闯天下 提交于 2019-11-28 08:34:07

问题


For some problem that we couldn't solve, I want to disable keep alive on Apache HttpClient 3.1. However, I couldn't find any resource on the Internet for that. Do you know how to do it?


回答1:


You can disable HTTP 1.1 support on you method, i.e. httpMethod.setHttp11(false); but you will lost some other features.

You can also try to force the connection header to ask the server to close the connection after its response: httpMethod.setRequestHeader("Connection", "close").



来源:https://stackoverflow.com/questions/16807691/disable-keep-alive-in-apache-httpclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!