title: How to disable encoding using RestTemplate
body: <p>I am using REST template to intentionally send a % in request uri, something like <code>/items/a%b</code></p>
  
  <pre><code>String responseEntity = restTemplate.exchange("/items/a%b",
               requestObj.getHttpMethod(), requestEntity, String.class);
  </code></pre>
  
  <p>The <code>restTemplate</code> is converting the endoding of this uri and it is becoming <code>/items/a%25b</code> which makes sense as the rest template by default encodes the uri.</p>
  
  <p>I tried using <code>UriComponent</code> for disabling the encoding of the uri</p>
  
  <pre><code>UriComponents uriComponents = UriComponentsBuilder.fromPath("/items/a%b").build();
  URI uri= uriComponents.toUri();
  
  String responseEntity = restTemplate.exchange(uri,
               requestObj.getHttpMethod(), requestEntity, String.class);
  </code></pre>
  
  <p>But this is not working as the uri again is of type URI which do the encoding. I am sure I am not using the UriComponents the right way.</p>
  
  <p>I would really appreciate if anyone could point out what's the right way of disabling the encoding.</p>
  
  <p>Thanks.</p>