title: Accessing parts of a multipart/form-data post request in a Java REST web service
body: <p>I have a multipart form which is supposed to upload a file as well as some parameters. It looks like this:</p>
  
  <pre><code>&lt;form id="upload" action="http://localhost:9998/test" method="post" enctype="multipart/form-data"&gt;
      &lt;input name="inputfile" type="file" size="50" accept="application/octet-stream"&gt;
      &lt;input name="someparameter" type="text" size="10"&gt;
      &lt;input type="submit" value="Go!"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The web service looks like this:</p>
  
  <pre><code>@Path("/test")
  public class ServiceInterface {
      @POST
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public void execute(@FormParam(value="someparameter") String param) {
          System.out.println(param);
      }
  }
  </code></pre>
  
  <p>When submitting the form, the value for "someparameter" is always reported as null although in the form I entered a value.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>What is wrong with the above code?</li>
  <li>How would I access the file which is transmitted with the form?</li>
  </ol>
  
  <p>I am using Jersey 1.10.</p>