Maven jersey-multipart missing dependency for javax.ws.rs.core.Response

前端 未结 2 1445
时光取名叫无心
时光取名叫无心 2021-01-05 12:56

I seem to have a missing dependency but can\'t find the solution... I\'ve made sure all jersey versions are identical as answered here.

Error:

  SEVE         


        
相关标签:
2条回答
  • 2021-01-05 13:50

    @FormDataParam seems to be very fussy about the @Consumes annotation. Note that (unlike just about everything else) placing this annotation on an interface definition of the method isn't good enough for @FormDataParam !

    0 讨论(0)
  • 2021-01-05 13:51

    Yeah found it!

    Apparently the dependencies were OK.

    Added these to my imports

    import javax.ws.rs.Consumes;
    import javax.ws.rs.core.MediaType;
    

    And changed the code to

    @POST
    @Path("copy")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response copy(@FormDataParam("file") InputStream uploadedInputStream,
                @FormDataParam("file") FormDataContentDisposition fileDetail);
    

    And now suddenly everything works! So hope I can help someone else with the same problem...

    0 讨论(0)
提交回复
热议问题