How to send post request with spring @RequestBody in rest client -


i have class person.

class person{ integer id; string firstname; string lastname; //other params, constructors, getters & setters } 

& method

    @requestmapping(value = "/test", method = requestmethod.post)     public void testperson(             @requestbody person person){ ... } 

now need test using rest client. tried setting “request header” section of firefox plugin have “name” = “content-type” , “value” = “application/x-www-form-urlencoded” & add parameters in body,

id=1&firstname=aaa&lastname=bbb 

but it's giving 404.

if getting 404 response, means either request url wrong or using get method instead of post or vise versa.

then regarding passing person in request, if @requestbody used have pass json or xml in body of request playload.

json:

{   "id":1,   "firstname":"aaa",   "lastname":bbb } 

xml

<person>   <id>1<id>   <firstname>aaa</firstname>   <lastname>bbb</lastname>   </person> 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -