You cannot have two getters with the same uri, but with different request parameters. What you can do is have one getter method with many request parameters.
@RequestMapping(value = "uri", method = RequestMethod.GET) public String test(@RequestParam String type, @RequestParam String byUser)
then call it with two parameters
/questions/ask/?type=rest&byUser=john
You must process the logic inside the test method to properly process these parameters.
As for Darijan, I think he decided to solve two methods or one method, taking into account what is the main line. If you are going to use 2 methods, use two uri. If business logic is ok to go with one uri then use the way I answered
Sanjaya liyanage
source share