title: Spring's @RequestBody providing empty string on POST
body: <p>I have an application with Spring 3.0.5.RELEASE trying to get the full content of a post using @RequestBody. The method is called, but the string passed is always empty. I have checked, by placing breakpoints, that the StringHttpMessageConverter is called, but the inner HttpInputMessage is empty.</p>
  
  <p>I've seen this issue with both Jetty and Tomcat, so I'm discarding it's a problem with the container.</p>
  
  <p>Here is my sample controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/")
  public class SubscriptionController {
      @RequestMapping(value = "/requestbody", method = RequestMethod.POST)
      public ModelAndView mycustomAction(@RequestBody String body) {
  
          // body is always empty
          Logger.getLogger(this.getClass()).debug("REQUEST BODY '" + body + "'");
          return new ModelAndView("empty");
      }
  }
  </code></pre>
  
  <p>My application context is defined as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context 
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
      &lt;!-- Enable auto detection of controllers --&gt;
      &lt;context:component-scan base-package="com.big.viajerotelcel.controller" /&gt;
  
      &lt;!--
          use annotation driven mvc and one single validator with JSR-303
          standard
      --&gt;
      &lt;mvc:annotation-driven /&gt;
  
      &lt;!--
          Message source for this context, loaded from localized "messages_xx"
          files
      --&gt;
  
      &lt;bean id="messageSource"
          class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
          &lt;property name="basenames" value="classpath:i18n/messages" /&gt;
          &lt;property name="defaultEncoding" value="UTF-8" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Declare the Interceptor --&gt;
      &lt;mvc:interceptors&gt;
          &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"
              p:paramName="locale" /&gt;
      &lt;/mvc:interceptors&gt;
  
      &lt;!-- Declare the Resolver --&gt;
      &lt;bean id="localeResolver"
          class="org.springframework.web.servlet.i18n.SessionLocaleResolver" /&gt;
  
      &lt;!-- will load Tiles definitions! --&gt;
      &lt;bean id="tilesConfigurer"
          class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
          &lt;property name="definitions"&gt;
              &lt;list&gt;
                  &lt;value&gt;/WEB-INF/general.xml&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Tiles view resolver --&gt;
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;property name="viewClass"
              value="org.springframework.web.servlet.view.tiles2.TilesView" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Configure the multipart resolver --&gt;
      &lt;bean id="multipartResolver"
          class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
          &lt;!--
              one of the properties available; the maximum file size in bytes (5MB)
          --&gt;
          &lt;property name="maxUploadSize" value="5120000" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Adding these lines has no effect, the StringHttpMessageConverter is called either way --&gt;
  &lt;!--    &lt;bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter"/&gt;--&gt;
  &lt;!--           --&gt;
  &lt;!--    &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;--&gt;
  &lt;!--        &lt;property name="messageConverters"&gt;--&gt;
  &lt;!--          &lt;list&gt;--&gt;
  &lt;!--            &lt;ref bean="stringHttpMessageConverter"/&gt;--&gt;
  &lt;!--          &lt;/list&gt;--&gt;
  &lt;!--        &lt;/property&gt;--&gt;
  &lt;!--    &lt;/bean&gt;--&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I'm testing this using curl as follows:</p>
  
  <blockquote>
    <p>curl -d asd=123 -d qwe=456 <a href="http://localhost:8080/requestbody">http://localhost:8080/requestbody</a></p>
  </blockquote>
  
  <p>Any ideas or help is more than welcomed!</p>