I want to allow pagination in a REST API I am writing. I would like to send requests as follows
GET /people?page[number]=1page[size]=25
or maybe
GET /people?page.number=1page.size=25
- The request above is just an example of what I am trying to do, if you know of a cleaner way to send the request please advise.
Then
@RequestMapping(value = "/people", params = { "page" })
public void findAll(@RequestParam("page") PaginationInformation paginationInformation) {
}
PaginationInformation
is just a plain old pojo with number
and size
getters and setters.
Is something like this possible in the latest version of Spring? I realise I can just pass pageNumber
and pageSize
and bind as integers but I would rather use and object as I want to also support filtering which will be much more complex.