Skip to content

Rework server.servlet.encoding properties to clarify when they apply #45394

Open
@wilkinsona

Description

@wilkinsona
  • server.servlet.encoding.force, server.servlet.encoding.force-request, server.servlet.encoding.force-response
    • HttpEncodingAutoConfiguration applies them to auto-configured CharacterEncodingFilter
      • affects any servlet web app, not just an embedded web server
  • server.servlet.encoding.charset
    • HttpMessageConvertersAutoConfiguration applies it to auto-configured StringHttpMessageConverter
      • affects reading or writing of Strings during blocking HTTP exchanges (Spring MVC, RestTemplate, RestClient)
    • HttpEncodingAutoConfiguration applies it to auto-configured CharacterEncodingFilter
      • affects any servlet web app, not just an embedded web server
  • server.servlet.encoding.mapping
    • HttpEncodingAutoConfiguration applies it to ConfigurableServletWebServerFactory
      • affects servlet web apps using an embedded web server

Prior to #18827, properties were all named spring.http.encoding.*..
I think we need to move to somewhere between the two extremes, perhaps the following:

spring.servlet.encoding.charset
spring.servlet.encoding.force
spring.servlet.encoding.force-request
spring.servlet.encoding.force-response

spring.http.converters.string-encoding-charset

server.servlet.encoding.mapping

I'm unsure about both spring.servlet.encoding.charset and spring.http.converters.string-encoding-charset. The former should be applied to the auto-configured CharacterEncodingFilter that applies to all servlet web apps. The latter would be applied to the auto-configured StringHttpMessageConverter that applies to any blocking HTTP exchange using Spring MVC, RestTemplate, or RestClient. Having two properties that will have the same value the vast majority of the time is not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: pending-design-workNeeds design work before any code can be developedtheme: structureIssues related to the structure of the project and its code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions