title: Spring REST API for posting jar file
body: <p>I am using RESTful endpoints  for some file operations. I would want to post a jar file to my service via REST , I tried below approach but still it fails, I almost tried googling but could not find any solution.</p>
  
  <pre><code>@RestController
  public class MyController {
   ...
  
  @RequestMapping(value="/jobs/upload", method=RequestMethod.POST)
  public @ResponseBody ResponseEntity&lt;Void&gt; handleFileUpload(HttpEntity&lt;byte[]&gt; requestEntity){
      byte[] payload = requestEntity.getBody();
      InputStream logo = new ByteArrayInputStream(payload);
      HttpHeaders headers = requestEntity.getHeaders();
      return ResponseEntity.ok().build();
   }
  ...
  }
  </code></pre>
  
  <p><strong>Curl Command</strong> :  <code>curl -X POST --data-binary @/Users/path/to-jar/test-jar.jar localhost:8008/ctx/jobs/upload</code></p>
  
  <p><strong>[EDIT]</strong> : If I have to achive via --data-binary , how should my code look like? </p>
  
  <p>I am not able to proceed further could anyone please help. I saw lot of solutions on MultiPart but I am not able to fit it in. </p>