Skip to content

DATACMNS-1211 - Provide WebFlux Pageable and Sort argument resolver #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Dec 3, 2017

We now provide synchronous HandlerMethodArgumentResolvers (SyncHandlerMethodArgumentResolver) for Pageable and Sort objects to be used with WebFlux controllers. Resolution happens synchronously as we create Pageable and Sort from the query string which can be read without blocking. We support @SortDefault, @SortDefaults and @PageableDefault to apply defaulting along with fallback values.

class MyWebFluxConfigurer implements WebFluxConfigurer {

	@Override
	public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {

		configurer.addCustomResolver(new ReactiveSortHandlerMethodArgumentResolver(),
				new ReactivePageableHandlerMethodArgumentResolver());
	}
}

class MyController {

	@GetMapping("people/paged")
	public Flux<Person> findAll(@PageableDefault(size = 100, sort="firstname") Pageable pageable) {
	}

	@GetMapping("people/sorted")
	public Flux<Person> findAll(@SortDefault(sort="firstname") Sort sort) {
	}
}

Related ticket: DATACMNS-1211.

Add ReactiveSortHandlerMethodArgumentResolver and extract shared code from imperative SortHandlerMethodArgumentResolver into SortHandlerMethodArgumentResolverSupport.
Add ReactivePageableHandlerMethodArgumentResolver and extract shared code from imperative PageableHandlerMethodArgumentResolver into PageableHandlerMethodArgumentResolverSupport.
@odrotbohm odrotbohm force-pushed the issue/DATACMNS-1211 branch from 161870e to a8ffa26 Compare August 29, 2018 10:52
@Opalo
Copy link
Contributor

Opalo commented Sep 13, 2018

What is the status of this PR?

@mp911de
Copy link
Member Author

mp911de commented Sep 13, 2018

We want to include the change and I think this will be part of the Moore release train.

Spring Operator added 2 commits March 18, 2019 17:46
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 1 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0 with 2 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 1 occurrences

Original pull request: #356.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 709 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #377
@reneschroeder0000
Copy link

Nice work. Did you think about implementing respective HATEOAS functionality as well? Currently when building the links, the queryParams won't be added.

@nekperu15739
Copy link

Like title said, i would like to have support for webflux, but for RouterFunctions. right now i'm doing some develop based on PageableHandlerMethodArgumentResolver, however, is better in my opinion that this feature comes with framework.

@regulskimichal
Copy link

Will this feature be included in Spring Data Moore? It's already RC3 stage... It would be nice to see it in the final version.

mp911de added a commit that referenced this pull request Sep 26, 2019
Add ReactiveSortHandlerMethodArgumentResolver and extract shared code from imperative SortHandlerMethodArgumentResolver into SortHandlerMethodArgumentResolverSupport.

Original pull request: #264.
mp911de added a commit that referenced this pull request Sep 26, 2019
Add ReactivePageableHandlerMethodArgumentResolver and extract shared code from imperative PageableHandlerMethodArgumentResolver into PageableHandlerMethodArgumentResolverSupport.

Original pull request: #264.
@mp911de
Copy link
Member Author

mp911de commented Sep 26, 2019

That's merged now.

@mp911de mp911de closed this Sep 26, 2019
@mp911de mp911de deleted the issue/DATACMNS-1211 branch September 26, 2019 14:44
@cbornet
Copy link

cbornet commented Mar 27, 2020

Are there plans to autoconfigure this in Spring Boot ?
I guess the next step would be to have SpringDataWebFluxConfiguration and EnableSpringDataWebfluxSupport in spring-data then SpringDataWebFluxAutoConfiguration in boot ?
I can have a look if that's the way to go.

@mp911de
Copy link
Member Author

mp911de commented Mar 27, 2020

The issue here is that these argument resolvers are only partial components. Their WebMVC variants are used to enable general Spring Data REST functionality. On their own, they are simple utilities that provide a certain value.

We are not going to provide a Webflux-based Spring Data REST integration. That being said, can you file a Spring Boot ticket for further discussion? Involving the Boot team usually leads to a better overall integration to figure our an ideal approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants