title: JAX-RS FileUpload with Apache CXF
body: <p>I'm trying to upload a file with JAX-RS and TomEE's Apache CXF implementation (2.6.14), but the uploaded file is always null. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>  @POST
    @Path("/upload")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response uploadFile(@Multipart(value = "file") @NotNull Attachment attachment) throws UnsupportedEncodingException {
      try {
  
        System.out.println(attachment);
  
        return Response.ok("file uploaded").build();
  
      } catch (Exception ex) {
        logger.error("uploadFile.error():", ex);
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
      }
    }
  </code></pre>
  
  <p>and a very easy HTML-file for the upload:</p>
  
  <pre><code>&lt;form action="http://127.0.0.1:8080/eegrating/restapi/cashflowparameter/upload" method="post" enctype="multipart/form-data"&gt;
      &lt;p&gt;File:&lt;br&gt;
          &lt;input name="file" type="file" size="50" maxlength="100000" accept="text/*"&gt;
          &lt;input type="submit" name="Submit" value="Send"&gt;
      &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The request header looks fine:</p>
  
  <p><em>------WebKitFormBoundaryOCleIjB2JgeySK0w
  Content-Disposition: form-data; name="file"; filename="git.txt"
  Content-Type: text/plain</em></p>
  
  <p>But the attachment is always null. Any suggestions? Thanks in advance.</p>