title: 415 Status when trying to send FormData() in Jax-RS jersey
body: <p>I'm trying to send files which is appended to FormData using jquery ajax. After referring some of mozilla and IBM's documents, I've came up with following.</p>
  
  <p>ajax code:</p>
  
  <pre><code>var sessionId = $.cookie("referenceId");
  var myFormData = { sessionId: sessionId,
                      cipherData: cipherData,   // Encrypted xml data
                      payslip: document.getElementById('payslip').files[0]};
  var formData = new FormData();
  for (var key in myFormData) {
      console.log(key, myFormData[key]);
      formData.append(key, myFormData[key]);
  }
  $.ajax({
      url : 'api/rootpath/childpath',
      type : 'POST',
      processData: false,
      contentType: false,    // Here the contentType is set to false, so what should I put at @Consumes in java code
      data : {
          formData: formData
      },
      success : function(data,status) {
          alert('success');
      },
      failure : function(data) {
  
      }
  });
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>@POST
  @Path("/childpath")
  @Consumes(MediaType.MULTIPART_FORM_DATA)  // I tried removing it, changing it to various formats, but none worked
  public Response createLoan(@FormParam("cipherData") String cipherData,@FormParam("sessionId") String sessionId,
                             @FormParam("payslip") File payslip);
  </code></pre>
  
  <p>I've been trying this for a day. I do manage to receive the file by directly submitting the form of <code>enctype="multipart/form-data"</code>, but I need to do it in ajax. If I look at my tomcat's log, it always gives me 415 status code when accessing <code>api/rootpath/childpath</code>. I think the problem is due to different content type received when comparing with original content type. I tried changing the <code>MediaType.</code> to "multipart/form-data" etc, but it failed.</p>