java - How to check spring RestController for unknown query params? -
I have to take a basic rest controller parameter.
How can I refuse the query string connection to the parameters that I would not have defined? @RestController @RequestMapping ("/") Public class MyRest {@RequestMapping (value = "/ {ID}", Method = RequestMethod.GET) @ ResponseBody Public String Content (@ PathWarrile ID , @ Rajesteparam (value = "page", required = incorrect) int page) {return id; }}
localhost: 8080 / myapp / 123? Pagggge = 1
While calling this URL, the method just id, and the unknown paggge parameter is just ignored. Which is normally okay, but how can I validate them and if an HTTP status code is returned?
Add HTTPSArlet request request to the method criteria,
string query = request.getQueryString () Methodize and validate in the body.
Comments
Post a Comment