title: How are Jersey @Consumes endpoints matched?
body: <p>I am designing a RESTful endpoint to receive files. I would like to it to accept POSTing as both plain file/stream and multipart. Is there a rule how are endpoints matched by the servlet container? Would the code below work reliably, or is this implementation specific? Can I get away with WILDCARD, or do I have to limit this to APPLICATION_OCTET_STREAM?</p>
  
  <pre><code>@Path("foo")
  public class Foo {
      @POST
      @Path("{filename}")
      @Consumes(MediaType.WILDCARD)
      public Response uploadFileDirect(
          @PathParam("filename") String filename,
          InputStream is)
      {
          // process input stream
          Response.ok().build();
      }
  
      @POST
      @Path("{filename}")
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public Response uploadFileMultipart(
          @PathParam("filename") String filename,
          @FormDataParam("file") InputStream is)
      {
          // process input stream
          Response.ok().build();
      }
  }
  </code></pre>