title: XML/JSON POST with RequestBody in Spring REST Controller
body: <p>I am creating a RESTful website with Spring 3.0. I am using <code>ContentNegotiatingViewResolver</code> as well as HTTP Message Convertors (like <code>MappingJacksonHttpMessageConverter</code> for JSON, <code>MarshallingHttpMessageConverter</code> for XML, etc.). I am able to get the XML content successfully, if I use the .xml suffix in the last of url and same in case of JSON with .json suffix in URL.</p>
  
  <p>Getting XML/JSON contents from controller doesn't produce any problem for me. But, <strong>how can I POST the XML/JSON with request body in same Controller method?</strong></p>
  
  <p>For e.g.</p>
  
  <pre><code>@RequestMapping(method=RequestMethod.POST, value="/addEmployee")
     public ModelAndView addEmployee(@RequestBody Employee e) {
          employeeDao.add(e);
          return new ModelAndView(XML_VIEW_NAME, "object", e);
  }
  </code></pre>