title: How to set HTTP Protocol version when using Spring restTemplate.exchange?
body: <p>I'm using Spring Framework <strong>restTemplate.exchange</strong> method to perform <strong>HTTPS GET</strong> call and map the response object to the entity class like below.
  The target server gives success response only when I send the request with HTTP protocol version 1.1 (<strong>HTTP1.1</strong>). I verified it using the curl command. RestTemplate uses HTTP1.2 by default. I'm using Apache HTTP Client v4.3 here in which <strong>httpClient.getParams</strong> is deprecated. So I'm not able to set the HTTP protocol version using getParams method. Is there any other way to set the http protocol version as <strong>HTTP1.1</strong> when using restTemplate.exchange method?</p>
  
  <pre><code>@Autowired
  CloseableHttpClient httpClient;
  
  @Bean
  public RestTemplate restTemplate() {
      RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory());
      return restTemplate;
  }
  
  @Bean
  public HttpComponentsClientHttpRequestFactory clientHttpRequestFactory() {
      HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new 
          HttpComponentsClientHttpRequestFactory();
      clientHttpRequestFactory.setHttpClient(httpClient);
      return clientHttpRequestFactory;
  }
  
  public ResponseEntity&lt;Foo&gt; getResponse(){
      RestTemplate restTemplate = restTemplate();
      HttpHeaders headers = new HttpHeaders();
      headers.setContentType(MediaType.APPLICATION_JSON);
      HttpEntity entity = new HttpEntity(headers);
  
      ResponseEntity&lt;Foo&gt; response = restTemplate
         .exchange(fooResourceUrl, HttpMethod.GET, entity, Foo.class);
  
      return response;
  }
  </code></pre>