title: JAX-RS Send File / InputStream from Client to RESTful Web Service
body: <p>I have to implement a RESTful Web Service which accepts xml-files.
  I have a Client-Application and a Server-Application using Jersey.</p>
  
  <p>Problem: I have to send a File from my Client to my RESTful Web Service.</p>
  
  <p>Client-Code:</p>
  
  <pre><code>File file = new File("Path_to_file.xml");
  InputStream in = new FileInputStream(file);
  Response response = this.client
                          .target("http://localhost:8080/rest/import/upload")
                          .request(MediaType.TEXT_PLAIN)
                          .post(Entity.xml(in));
  </code></pre>
  
  <p>Server-Code:</p>
  
  <pre><code>@Post
  @Path("/upload")
  @Consumes(MediaType.APPLICATION_OCTET_STREAM)
  @Produces
  public Response upload(@FormParam("file") File file) {
     ...code to validate File ...
  }
  </code></pre>
  
  <p>I cannot import: <code>javax.ws.rs.core.Form</code>,<code>javax.ws.rs.core.FormDataMultiPart</code>.
  Every answer I could find so far is telling me to implement these Classes.</p>
  
  <p>Hopyfully, someone can help me :)</p>
  
  <p>Greetz, Paddaels</p>