spring-projects / spring-projects/spring-framework

Remove code to set the ServletResponse contentType and characterEncoding properties from the "Content-Type" header

Open
#36,352 0 comments 0 reactions 1 assignee View on GitHub

@rstoyanchev is already working on this.

Since Feb 19, 2026.

in: web type: enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.