Reputation: 49077
I have a controller where I want to have two methods: One serve all items, and the other methods serves a subset.
Request mapping for serving everything:
@RequestMapping(method = RequestMethod.GET)
Request mapping for serving only partial:
@RequestMapping(method = RequestMethod.GET, params = {"page, limit"})
Now, even though the user writes /items?page=0&limit=45
the first methods is invoked. Is it possible to fix this? I would have thought that specifying further requirements on the second request mapping would be enough and that Spring MVC would choose the mapping which fullfills the requirements?
Upvotes: 0
Views: 387
Reputation: 20375
Shouldn't params
be defined with multiple String
parameter names as separate array entries? E.g.:
@RequestMapping(method = RequestMethod.GET, params = {"page", "limit"})
Upvotes: 1