How to consume json parameter in java restful service

后端 未结 3 1661
广开言路
广开言路 2020-12-09 18:17

How can i consume json parameter in my webservice, I can able to get the parameters using @PathParam but to get the json data as parameter have no clue what to do.



        
3条回答
  •  伪装坚强ぢ
    2020-12-09 18:57

    @PathParam is used to match a part of the URL as a parameter. For example in an url of the form http:/example.com/books/{bookid}, you can use @PathParam("bookid") to get the id of a book to a method.

    @QueryParam is used to access key/value pairs in the query string of the URL (the part after the ?). For example in the url http:/example.com?bookid=1, you can use @QueryParam("bookid") to get the value of `bookid.

    Both these are used when the request url contains some info regarding the parameters and you can use the data directly in your methods.

    Please specify the problem in detail if this post doesn't help you.

提交回复
热议问题