Skip to content
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

Improve documentation on reactive types for ResponseEntity [SPR-17400] #21933

Closed
spring-issuemaster opened this issue Oct 18, 2018 · 1 comment
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 18, 2018

Ankur Pathak opened SPR-17400 and commented

The documentation of Spring WebFlux Contoller Style is not proper and in general give three

example of using it:

  1. Mono<Pojo> sayHello(){}
  2. Flux<Pojo> sayHello(){}
  3. ResponeEntity<?> sayHello(){}

But what if I have Flux and Mono and I have custom headers to set, then what I have to do

no comment on that. I have seen many example on internet no one sure on that abd doing

the things as per their wish for example:

  1. ResponseEntity<Flux<Pojo>> sayHello() {}
  2. ResponseEntity<Mono<Pojo>> sayHello() {}
  3. Mono<ResponseEntity<Pojo>> sayHello() {} : May be blocking
  4. Mono<ResponseEntity<List<Pojo>> sayHello() {} Its Blocking

What is the correct way of doing it?? Please improve the documentation to cover these cases.

Or Provide the Support for Mono And Flux in ResponseEntity itself like:

  1. ResponseEntity.publisher(someMono).ok;
  2. ResponseEntity.publisher(someFlux).noResponse();

Its a blocker in migrating projects in Spring MVC to Spring Flux. Till the time documentation

or support improvement is done, Please provide the correct solution in current situation.

 

All these cases are properly covered for functional style and should be properly covered for

controller style as well.

 


Affects: 5.0.10, 5.1.1

Referenced from: commits 2eae37d, d492d7b

Backported to: 5.0.11

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 18, 2018

Rossen Stoyanchev commented

Thank you for raising this point. I do see that the section on ResponseEntity is lacking in detail around that. The fact is that WebFlux supports all combinations shown above.

Keep in mind however there should be no blocking. For example Mono<ResponseEntity<T>> simply means you obtain the Object first and then you're ready to return a ResponseEntity<T>.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.