Skip to content

gzip compression in DispatcherServlet [SPR-11714] #16336

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

1 votes, 11 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: taskA general task

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions