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

Consider adding static notFound() builder method to ResponseEntity [SPR-12070] #16686

Closed
spring-projects-issues opened this issue Aug 6, 2014 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 6, 2014

Marcel Overdijk opened SPR-12070 and commented

Since 4.1 RC1 The RepsonseEntity is extended with convenient static builders for e.g. ok(), created(), accepted() and noContent().

Next to that there is also a status(int status) methid to easily create response for other status codes.

In many projects I see quite a 404 not found codes returned.

So adding a notFound() static method would be desirable to add.


Affects: 4.1 RC1

Issue Links:

Referenced from: commits 5862ddc

@spring-projects-issues
Copy link
Collaborator Author

Michael Vitz commented

Could anyone please explain why you decided disallowing setting any body when using this builder?

I stumbled upon this issue multiple times. If there is no clear reason I would propose (maybe in a new issue) the addition of a builder with a body.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

No specific reason, just simple REST style 404s typically coming without a body. We could open up the existing notFound() to a BodyBuilder but I'm afraid that wouldn't be binary-compatible. There's always status(NOT_FOUND) which does return a BodyBuilder...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants