spring-projects / spring-projects/spring-framework
Remove code to set the ServletResponse contentType and characterEncoding properties from the "Content-Type" header
@rstoyanchev is already working on this.
Since Feb 19, 2026.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
Spring MVC generally works with the "Content-Type" header of the response rather than the contentType and characterEncoding properties of ServletResponse.
This is typically done through the HttpHeaders of ServletServerHttpResponse, and then merged into the ServletResponse headers, but as of #36334, we now use ServletResponseHeadersAdapter to map HttpHeaders opertions directly onto ServletResponse header methods.
As mentioned in #36343, Spring MVC has several places where it propagates the "Content-Type" header to the contentType and characterEncoding properties of ServletResponse. This shouldn't be necessary, but it remains in 7.0.x to avoid side effects. Going forward, we can remove it In the next minor version 7.1.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.