spring-data-commons icon indicating copy to clipboard operation
spring-data-commons copied to clipboard

Add SlicedResourcesAssembler for web integration.

Open mschout opened this issue 3 years ago • 3 comments

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 avatar Oct 04 '22 22:10 mschout

@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.

pivotal-cla avatar Oct 04 '22 22:10 pivotal-cla

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 avatar Oct 04 '22 22:10 mschout

@mschout Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Oct 04 '22 22:10 pivotal-cla

This has been polished and merged. Thanks again, @mschout, for the contribution!

odrotbohm avatar Mar 01 '23 14:03 odrotbohm