This PR introduces pagination for lists of sessions (user specific: owned and visited), interposed questions and free text answers and skill questions. While the first three are paginated through the database, skill questions are paginated in memory so caching is still possible.
To enable pagination, new HTTP headers based on RFC 7233 have been introduced:
Range: items=<start>-<end>, e.g.
Content-Range: items <start>-<end>/<total>, e.g.
Content-Range: items 0-9/42
Since it is not possible to determine the total count of items via CouchDB w/o performance losses, it is currently only set accurately for skill questions. In other cases
total is set to
Pagination support can be added to controllers by extending the newly introduced
PaginationController. Additionally, applicable methods have to be marked with the
@Pagination annotation so the
Range header is parsed and the
Content-Range header is set for responses. Pagination parameters are accessible in the controller through the
limit fields. If pagination on the DBAL is not possible, lists can be wrapped with
PaginationListDecorator<T> to enable in memory pagination.