Error 415 Unsupported Media Type: POST not reaching REST if JSON, but it does if XML

前端 未结 13 1864
渐次进展
渐次进展 2020-11-27 04:57

I am actually new to REST WS but really I don\'t get this 415 Unsupported Media Type.

I am testing my REST with Poster on Firefox and the GET

13条回答
  •  庸人自扰
    2020-11-27 05:34

    I get the same issue. In fact, the request didn't reach the jersey annoted method. I solved the problem with add the annotation: @Consumes(MediaType.APPLICATION_FORM_URLENCODED) The annotation @Consumes("/") don't work!

        @Path("/"+PropertiesHabilitation.KEY_EstNouvelleGH)
        @POST
        //@Consumes("*/*")
        @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
        public void  get__EstNouvelleGH( @Context HttpServletResponse response) {
            ...
        }
    

提交回复
热议问题