Pregunta

How do you set the protocol version on a CloseableHttpClient object or HttpPost object with http client 4.3 now that setParams and getParams are deprecated?

¿Fue útil?

Solución

HttpPost post = new HttpPost("/");
post.setProtocolVersion(HttpVersion.HTTP_1_1);

Otros consejos

or use that builder pattern they are so fond of these days:

final HttpUriRequest request = RequestBuilder.post()
    .setVersion(HttpVersion.HTTP_1_1)
    .setUri(requestURI)
    .addHeader(key, value)
    .... <whaterver more you want to add to the request>         
    .build()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top