将HttpClients HTTP版本更改为HTTP / 1.0

时间:2014-07-14 23:01:22

标签: apache-httpclient-4.x apache-httpcomponents

我试图在Apache HttpClient 4.3中使用HTTP / 1.0,但我无法找到方法。在3.x版本中,它以这种方式完成:

httpClient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_0);

现在已经弃用了。现在该怎么办? 谢谢。

1 个答案:

答案 0 :(得分:4)

HttpGet request = new HttpGet("/stuff");
request.setProtocolVersion(HttpVersion.HTTP_1_0);