title: @RequestBody not working- Returned Http Status 415 unsupported media type in Jquery
body: <p>I am using Spring 3.1 to develop my project. During the work I stuck at a point and really need your help. </p>
  
  <p>My requirement is from client I will receive JSON object and will return JSON object too. I am successful to implement the same when I am using get post and delete request send from Server. But when I am using <code>PUT</code> method to send my data facing some problem. Because <code>PUT</code> cant receive data in <code>@ModelAttribute</code> I am using <code>@RequestBody</code> annotation to receive my data send from client.</p>
  
  <p>When I use <code>@RequestBody MultiValueMap&lt;String, String&gt;</code> body get a error</p>
  
  <blockquote>
    <p>Http Status 415 unsupported media type.</p>
  </blockquote>
  
  <p>When I try to receive data with <code>@RequestBody DemandBean</code> (my project Bean) I receive the following error.</p>
  
  <blockquote>
    <p>org.codehaus.jackson.JsonParseException: Unexpected character ('o' (code 111)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
    at [Source: org.apache.catalina.connector.CoyoteInputStream@19 d688; line: 1, column: 2]</p>
  </blockquote>
  
  <p>But I am quite sure that I have mapped my jackson library properly because with <code>@RequestBody</code> I can receive the json back to client and also can send Json and spring can parse with <code>@ModelAttribute</code> in case of method is <code>GET</code>,<code>POST</code>,<code>DELETE</code>.</p>
  
  <p>Below I am giving the code :</p>
  
  <p><strong>Html FIle to send data:</strong></p>
  
  <pre><code> var jsonStr = $("#searchDemand_frm").serializeArray();
  
   $("#searchResultTable td").remove();
  
   alert(JSON.stringify(jsonStr)); // Return proper form data in json format
  
   $.ajax({
      contentType : "application/json",
      dataType : 'json',
      type : "PUT",
      url : targetUrl,
      data : jsonStr,
      async : false,
      success : function(data) {
         alert("In Success");
      },
      error : function(request, status, error) {
         showPermissionDenied(request);
      }
  });
  </code></pre>
  
  <p><strong>Json format send to server:</strong></p>
  
  <pre><code>[{"name":"opportunityId","value":"ad"},{"name":"dem andId","value":"hgh"},{"name":"demandCreator","val ue":"hghhgh"},{"name":"demandOwner","value":"hg"}, {"name":"status","value":"IP"},{"name":"region","v alue":"hgh"}]
  </code></pre>
  
  <p><strong>-Servlet.xml:</strong></p>
  
  <pre><code>&lt;mvc:annotation-driven /&gt;
  
  &lt;context:component-scan base-package="com.ericsson.rms.controller.*" /&gt;
  &lt;context:component-scan base-package="com.ericsson.rms.application.authorizatio n" /&gt;
  &lt;context:annotation-config/&gt;
  
  &lt;aop:aspectj-autoproxy proxy-target-class="true" /&gt;
  
  &lt;bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/&gt;
  
  &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
     &lt;property name="messageConverters"&gt;
        &lt;list&gt;
           &lt;ref bean="jacksonMessageConverter" /&gt;
        &lt;/list&gt;
     &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>Controller Class:</strong></p>
  
  <pre><code>@RequestMapping(method = RequestMethod.PUT)
  public @ResponseBody
     List&lt;DemandBean&gt; searchDemandDetailsWithPut(@RequestBody DemandBean demand, 
                                                 HttpServletResponse response) throws IOException {
  }
  </code></pre>