question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ResponseEntity<Single<>> instead of Single<ResponseEntity<>>

See original GitHub issue

The new code introduced here allows the controller to return Single or Observable.

Although it has some flaws handling the http status code.

  1. It does not honor @ResponseStatus annotations on the controller itself.
  2. It does support ResponseEntity<Single<>> which is useless in any case where the status code depends on the reactive code, for instance: it is impossible to write a proper ResponseEntity<Single<User>> findUser() method as it will necessarily subscribe and consume the Single at the controller instead of at the response handler.
  3. It doesn’t implement support for Completable.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
rstoyanchevcommented, Apr 7, 2016

Indeed it looks like there is no way to vary the status based on the outcome. In other words it should deal with Single<ResponseEntity<>>.

Not sure what’s the issue with @ResponseStatus. That should be set regardless of the return value handler used. Perhaps it’s getting overridden later when the Single completes?

1reaction
spencergibbcommented, Oct 5, 2016

now 1.2.0.RELEASE

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - What is the best way to return different types of ...
One solution is to use ResponseEntity<Object> . An other is to use the a BaseClass or Interface for types Success and Error. –...
Read more >
Using Spring ResponseEntity to Manipulate the HTTP Response
In this short tutorial, we'll see how to set the body, status, and headers of an HTTP response using ResponseEntity.
Read more >
ResponseEntity (Spring Framework 6.0.2 API)
Extension of HttpEntity that adds an HttpStatusCode status code. Used in RestTemplate as well as in @Controller methods. In RestTemplate , this class...
Read more >
Using ResponseEntity in Spring Application - Java Guides
ResponseEntity represents an HTTP response, including headers, body, and status. While @ResponseBody puts the return value into the body of the response, ...
Read more >
Using ResponseEntity in Spring - Technicalsand
ResponseEntity and RequestEntity both are the extensions of HttpEntity. ResponseEntity represents an HTTP response including status, headers and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found