Jersey POST Method is receiving null values as parameters

后端 未结 4 1165
情话喂你
情话喂你 2020-12-09 05:18

I am developing RESTful services with Jersey and it works great with GET methods. However I can\'t make it work with POST methods and JSON or text parameters. These is what

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 05:59

    I'd post this as a comment to the accepted answer, but I'm just shy of being able to do that.

    In addition to the excellent advice above, I would add that, at least in version 2.0.x, Jersey does not pull @FormParam from the query string. Instead, it expects it to be included as a name-value pair in the request body.

    For example, instead of POST http://localhost/app?name=Joe, you would send POST http://localhost/app with the body:

    name=Joe
    

提交回复
热议问题