title: Multiple lists of files over REST on Jersey using Java
body: <p>I've seen a number of examples on how to do this with only one file, but I'd like to accept two lists of files over a single REST call and reference each list by name.  I'm using this as my method:</p>
  
  <pre><code>@POST
  @Path("/initialize")
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  public String initialize(MultiPart data) {
      List&lt;File&gt; maps = new ArrayList&lt;&gt;();
      List&lt;File&gt; contexts = new ArrayList&lt;&gt;();
  
      for(BodyPart bodyPart : data.getBodyParts()){
          String name = bodyPart.getContentDisposition().getParameters().get("name");
          if(name != null &amp;&amp; name.equals("maps")){
              //get the files from this bodyPart and add them to maps
          } else if (name != null &amp;&amp; name.equals("contexts")){
              //get the files from this bodyPart and add them to contexts
          }
      }
      return "foo";
  }
  </code></pre>
  
  <p>Can anyone help me make the final step here and get the actual input streams out of the bodyParts?  They have a getEntity() field, but I'm not sure that's what I'm looking for.</p>