title: How to set http request body using Spring RestTemplate execute?
body: <p>I'd like to use <em>RestTemplate</em> to issue requests. I must send a request payload with a GET request. Yeah-yeah, I know. So I tried <em>RestTemplate.exchange</em>, but it seems it is not sending the payload for GET requests, no matter what. So I looked further in the docs and figures <em>RestTemplate.execute</em> might be what I am looking for ... and now here I am.</p>
  
  <p>So the doc states about <em>execute</em>:</p>
  
  <blockquote>
    <p>Execute the HTTP method to the given URI template, preparing the request with the <em>RequestCallback</em>, and reading the response with a <em>ResponseExtractor</em>. </p>
  </blockquote>
  
  <p><a href="http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/web/client/RestTemplate.html" rel="nofollow">http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/web/client/RestTemplate.html</a></p>
  
  <p>Okay. Let's see <em>RequestCallback</em></p>
  
  <blockquote>
    <p>Callback interface for code that operates on a <em>ClientHttpRequest</em>. Allows to manipulate the request headers, and write to the request body. 
    Used internally by the <em>RestTemplate</em>, but also useful for application code.</p>
  </blockquote>
  
  <p><a href="http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/web/client/RequestCallback.html" rel="nofollow">http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/web/client/RequestCallback.html</a></p>
  
  <p>But <em>RequestCallback</em> has one method only: <em>doWithRequest</em>, which accepts it's parameter through the <em>ClientHttpRequest</em> interface... which has no methods for setting/manipulating the body of the request. Sadly. :C</p>
  
  <p><a href="http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/http/client/ClientHttpRequest.html" rel="nofollow">http://docs.spring.io/spring-framework/docs/3.2.8.RELEASE/javadoc-api/org/springframework/http/client/ClientHttpRequest.html</a></p>
  
  <p>So, I have two questions:</p>
  
  <ul>
  <li>What am I missing here regarding the docs?</li>
  <li>How can I issue a GET request with a payload/request body using RestTemplate?</li>
  </ul>