How to Consume JSON as input in PUT and POST method of REST webservice in java

孤街浪徒 提交于 2019-12-05 22:10:31

This may help get you going: http://blog.sertik.net/labels/jersey.html

From my (extremely rusty) recollection, you sort of treat the @PUT methods the same way you treat @POST methods. So as shown in that blog entry, try using the @FormParam annotations. Also, read over the Jersey API to see if anything looks useful.

The main difference between them (PUT/POST) is in the meaning; PUT typically creates a new resource at the uri, whereas POST can 'append to' it (there are also a few other meanings to what exactly POST does).

PS almost forgot to mention, cURL is so.... nice.

Hey there is a built in support for JSON in JAX-RS.For this you just need to write the POJO class with JAXB annotations. JAX-RS has built in MessageBodyReaders and MessageBodyWriters to support.If you want to POST i.e., sending the Custom Data you need to write your own MessageBodyReaders/Writers and register them with the Client.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!