-
Notifications
You must be signed in to change notification settings - Fork 38.5k
When a @RequestMapping Returns a Sublclass of ResponseEntity It Is Returning Header and StatusCode Along with the Body [SPR-10046] #14680
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
Comments
Rossen Stoyanchev commented You don't need |
Julian Builes commented Rosen, I am not sure if I am missing something trivial here, but if I remove the javax.servlet.ServletException: Could not resolve view with name '<some path>' in servlet with name '<servlet name>'. |
Rossen Stoyanchev commented
|
Shelley J. Baker commented This doesn't work for ResponseEntity subclasses, though. In particular, the HttpEntityMethodProcessor's supportsReturnType method explicitly looks for ResponseEntity/HttpEntity classes, not whether they are assignable from those classes:
Changing this method to the following seems to do the trick:
(Or as a temporary workround, you can add a custom HandlerMethodReturnValueHandler which overrides this method.) |
Rossen Stoyanchev commented I think it'd be best to open a new issue. The original description here mixes |
Shelley J. Baker commented #14840 has been logged for this issue. |
Julian Builes opened SPR-10046 and commented
When subclassing ResponseEntity that returns a JSON response, the body in the resulting response is also including 'headers' and 'statusCode fields.
Is returning:
Considerations:
Affects: 3.1.3
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: