spring-data-commons
spring-data-commons copied to clipboard
Add SlicedResourcesAssembler for web integration.
Added SlicedResourcesAssembler to esaily convert Slice instances into SlicedResource instances and automatically build the required previous/next link based on PageableHandlerMethodArgumentResolver present in the MVC configuration. The assembler can either be injected into a Spring MVC controller or a controller method. The latter will then assume the controller methods URI to be used as pagination link base.
Added necessary SlicedResourcesAssemblerArgumentResolver and MethodParameterAwareSlicedResourcesAssembler classes and wire up HateoasAwareSpringDataWebConfiguration configuration beans to that SlicedResourcesAssembler's can be auto-injected into controllers.
Closes #1307
- [x] You have read the Spring Data contribution guidelines.
- [x] You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
- [x] You submit test cases (unit or integration tests) that back your changes.
- [x] You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
@mschout Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
NOTE: this depends on https://github.com/spring-projects/spring-hateoas/pull/1856 which adds SlicedModel, so this one could not possibly be merged until the spring-hateoas change gets done.
@mschout Thank you for signing the Contributor License Agreement!
This has been polished and merged. Thanks again, @mschout, for the contribution!