Adding pagination, filters, and sorting capabilities

Now we have introduced the basis for a REST configuration of Spring MVC, we will improve our REST services by adding pagination, filtering, and sorting capabilities.

Getting ready

Pagination is a concept developed in the Spring Data project. To add pagination, we will introduce the Pageable interface for wrapper implementations populated from the request. These are further on recognized and handled by Spring Data.

The Page interface and specifically the PageImpl instances can be produced by Spring Data to format its results. We will use them, as they are perfectly suited to REST rendering.

Finally, we will detail two data-binding tools used here to abstract filtering and pagination from our controllers' ...

Get Spring MVC Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.