REST POST with MultiValueMap is always empty
I've just started working with Spring 3.0 M3 to write a REST API for use instead of an existing SOAP API. I followed the instructions for creating a restful service. Any methods that I've annotated as POST that take a @RequestBody MultiValueMap never receive a populated Map. If I create an equivalent method with a PUT the map is successfully populated. Here's two examples:
@RequestMapping(value = "/service/postTest", method = RequestMethod.POST)
public String testPost(@RequestBody MultiValueMap<String, Object> params,
Model model)
{
System.out.println(params);
return "redirect:/service/token/" + 1;
}
@RequestMapping(value = "/service/putTest", method = RequestMethod.PUT)
public void testPut(@RequestBody MultiValueMap<String, Object> params,
Model model)
{
System.out.println(params);
}
As you can see the two methods are identical except for the URI, request method, and the PUT doesn't return a value. I'm using the RestTemplate in a simple main method to call the methods. I tried running the WAR file I created in glassfish, tomcat 6, and jetty 6. Both glassfish and tomcat exhibited the same behavior. Jetty however also exhibited the problem with the PUT method. I tried changing the MultiValueMap above to a String and this worked for POSTing in both Jetty and glassfish. I tried debugging the spring code to find the problem and I found that in the FormHttpMessageConverter method readInternal line 66 is where the problem shows up. In cases where no parameters are returned the input reader doesn't return any data in the copyToString method.
Is there anything that I'm doing wrong? I can provide more information if needed.