-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Attempt to reset Servlet response before calling ExceptionHandlers #31104
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for your contribution @aooohan ! |
bclozel
added a commit
to bclozel/spring-framework
that referenced
this pull request
Aug 30, 2023
Revert previous changes for spring-projectsgh-31104 and apply them on DispatcherServlet
After discussing this with @rstoyanchev , we agreed that dealing with this at the I've adressed that in 0d7c9b7. |
bclozel
added a commit
that referenced
this pull request
Aug 30, 2023
This is a follow-up change related to gh-31104. This change reverts the changes previously made in `ExceptionHandlerExceptionResolver` and instead attempts to reset the response directly in `DispatcherServlet` in order to cover all types or exception handling. Unlike the previous change, we decided to continue even if the response was already committed: exception handlers will have a chance to be called, even if it means they'll have to operate on a garbled response. This change will cause less disruption, in case existing exception handlers were relying on this behavior. See gh-31104
bclozel
added a commit
that referenced
this pull request
Sep 8, 2023
Prior to this commit, `DispatcherServlet` would completely reset the response (status, headers and body) before handling errors within Spring MVC. This can cause unintended consequences when Servlet Filters added response headers before the error happened. Such response headers might be still required in case of error handling. This commit changes the complete reset of the response to only resetting the response buffer, if possible. Closes gh-31154 See gh-31104
This was referenced Oct 20, 2023
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #30702
If any other changes are needed, feel free to ask me. : )