title: RestTemplate POST request RequestParams and RequestBody
body: <p>I have a server and a client. I am using Spring to map http requests on the server and RestTemplate to make requests to the server.</p>
  
  <p>Server code looks like this:</p>
  
  <pre><code>@RequestMapping (value="/someEndPoint", method = RequestMethod.POST)
  @ResponseBody
  public String configureSettings(
  @RequestParam(required=false) Integer param1,
  @RequestParam(required=false) Long param2,
  @RequestBody String body)
  {
  
  if(param1 != null)
  // do something
  
  if(body not empty or null)
  //do something
  
  } 
  </code></pre>
  
  <p>Client side:</p>
  
  <pre><code>String postUrl = "http://myhost:8080/someEndPoint?param1=val1"
  restTemplate.postForLocation(postUrl, null);
  </code></pre>
  
  <p>This works in that the correct action is triggered on the server side from param1
  however, the body of the request also contains:<br>
  param1=val1<br>
  The request body when it is set it will json so all I want is to be able to set other parameters without setting the body.
  I know I am using the restTemplate incorrectly so any help would be greatly appreciated.</p>