title: REST multipart mixed request (file+json) with Spring
body: <p>I need to send a file alongside with a json to my Spring Controller. I have the following controller class: </p>
  
  <pre><code>@Controller
  @RequestMapping("/perform")
  public class PerformController {
  
      ...
  
      @RequestMapping(path = "gopdf", method = RequestMethod.POST, consumes = { "multipart/mixed" })
      @ResponseStatus(HttpStatus.CREATED)
      public void handleFileUpload(@RequestPart("file") MultipartFile file, @RequestPart("map") String map,   HttpServletResponse response) throws Exception {
          ...
      }
  
  }
  </code></pre>
  
  <p>But when I curl on my server with the following command :</p>
  
  <pre><code> curl -H "Content-Type: multipart/form-data" -F "map=@map.json; type=application/json" -F "content=@SMP.docx" -X POST localhost:9000/perform/gopdf-i -v
  </code></pre>
  
  <p>I get 415 unsupported Media Type !</p>
  
  <p>Any clue ?</p>