title: How to use @RequestBody with a JSONP request?
body: <p>I am trying to perform an ajax request using the jsonp data type due to cross domain issues in a clustered environment.</p>
  
  <p>I can make jsonp requests to methods mapped with no @RequestBody parameters, but when I do try to implement a RequestMapping with a @RequestBody parameter I get a 415 Unsupported Media Type error.</p>
  
  <p>Usually when I get this problem it is due to some property not mapping correctly between the json object posted and the Java object it is mapped to in Spring. But the only discrepency I can find is that using jsonp it adds a parm named callback and one with the name of an underscore "_"</p>
  
  <p>So I added the tag @JsonIgnoreProperties(ignoreUnknown = true) to my Java object and figured that should solve that, however it is still throwing this error.</p>
  
  <p>Is there anything else I need to do?</p>
  
  <p>EDIT: I am now seeing this stack trace in the debug log output from Spring:
  org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/octet-stream' not supported</p>
  
  <pre><code>$.ajax({
    url : 'http://blah/blah.html',
    data : { abc : '123' }, (I also tried to JSON.stringify the object but no difference)
    dataType : 'jsonp',
    success : function(response) {
      alert('ok '+JSON.stringify(response));
    },
    fail : function(response) { 
      alert('error'+JSON.stringify(response));
    }
  });
  </code></pre>
  
  <p>The Spring controller is:</p>
  
  <pre><code>@RequestMapping({ "blah/blah" })
  @ResponseBody
  public ReturnObject getBlahBlah (@RequestBody MyObject obj) throws Exception {
  
      }
  </code></pre>
  
  <p>The parameter object is:</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true)
  public class MyObject {
  
    private String abc;
    // getter and setter for abc auto generated by MyEclipse
  }
  </code></pre>
  
  <p>I have a breakpoint on the Controller method which is never hit.</p>