Supporting both Multipart and Application Url Encoded parameters in Jersey
问题 I have a rest service in Jersey. I would like to have some post method that accepts parameters both as multipart and as url encoded. I started with : @POST @Path("/some/resource") public String addSomeResource(@FormParam("param") String param) { repository.add(new SomeResource(param)); } My understanding is that using @Consumes more narrowly defines what's acceptable, and sure enough, this method is called whether someone attaches form data the usual way $.ajax({url:'/some/resource', type: