Description
Christopher Smith opened SPR-11714 and commented
A very old issue to add gzip compression to the Web MVC framework was closed in favor of configuring compression at the server level, but I'd like to revisit the issue.
I've been working on adding compression as a configuration option to Spring Boot, and configuring it for either Tomcat or Jetty requires an explicit list of every content type that is eligible for compression, a list that conspicuously does not by default include application/json
in either case, and can't take wildcards to compress application/*+json/xml
. I've dug more into Tomcat, but configuring it requires protocol-specific casts to get to the config methods, and configuring the eligible content types is not thread safe (and in a Spring context can't reliably be done before publication). Additionally, the newer NIO connectors on Jetty and Tomcat can both have some collisions with compression.
I suggest inserting a compressing wrapper around the HttpServletResponse
in the view.render
call in the DispatcherServlet
. Would this feature be considered "on-topic" at this point?
Affects: 4.0.3
Reference URL: #5514
This issue is a sub-task of #16413
Issue Links:
- Add support for compressing resources [SPR-7140] #11799 Add support for compressing resources
- GZIP compression filter [SPR-787] #5514 GZIP compression filter
1 votes, 11 watchers