java - @PathVariable and @RequestParam not working together -
i have below code in controller:
@requestmapping(value = "/child/{nodeid}/{reltype}",method = requestmethod.get, produces=mediatype.application_json) public iterable<node> getconnectednodes(@requestparam("page")int page, @requestparam("size")int size, @pathvariable("nodeid") string nodeid, @pathvariable("reltype") string reltype) { return nodeservice.getconnectednodes(nodeid, reltype,page,size); }
and api url hitting
http://localhost:8080/node/child/e17a64ff-dc2b-49b1-a995-67dba9413d67/collegues?page=0&size=1
here in debug mode can see values of path variables i.e. nodeid , reltype can not see values of request param page , size passing through request in url above.
what's wrong @requestparam ? please help.
can try below snippet:
@requestmapping(value = "/child/{nodeid}/{reltype}",method = requestmethod.get, produces=mediatype.application_json) public iterable<node> getconnectednodes(@requestparam(value="page", required=false) int page, @requestparam(value="size", required=false) int size, @pathvariable("nodeid") string nodeid, @pathvariable("reltype") string reltype) { return nodeservice.getconnectednodes(nodeid, reltype,page,size); }
Comments
Post a Comment