-
Notifications
You must be signed in to change notification settings - Fork 38.4k
gzip compression in DispatcherServlet [SPR-11714] #16336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented This isn't a bad fit with our 4.1 web theme, actually: It's all about web performance options such as cache control and resource pipelining... brianclozel, I'm assigning this to you since you're the owner of the related issues for 4.1 as well. Juergen |
Christopher Smith commented Then I'll add a note that I'd love for the resource framework to be able to handle precompressed copies "intelligently" (e.g., serve |
Brian Clozel commented Thanks Juergen Hoeller! Good idea. Christopher Smith we're already working on a related feature for resource handling (see #15561). I guess this could be implemented using a resource resolver, checking for resources that match the resource name + extensions variants. That's definitely a use case we'll look into. This feature is still work in progress at the moment, so expect some changes! |
Phil Webb commented Brian Clozel If this makes 4.1 and there are any Boot related changes required to enable it by default could you reopen spring-projects/spring-boot#683 ? Cheers! |
Christopher Smith commented Looks like this Patrick account is a spambot. |
Stéphane Nicoll commented Indeed, thanks for pinging us about it. |
Brian Clozel commented Here are some thoughts about this - let me know what you think! Current limitations with using Tomcat/JettyI know that Tomcat and other servers aren't checking that mimetypes are compatible (in the sense of the related mime type/HTTP rfc) - but they do offer some flexibility regarding this:
Also, you're stuck with custom configuration files or APIs when configuring this. Implementing this in Spring FrameworkWhile this is something we're considering for 4.2, I've found several drawbacks/challenges.
Given the not so big limitations and the drawbacks listed above, I'm wondering if implementing this is actually worth it. |
cemo koc commented I agree with Brian and believe that this issue is a better candidate for Spring Boot with low level capabilities. Note that Jetty deprecated support for GzipFilter and It is replaced with GzipHandler. |
Christopher Smith commented Given the move toward embedded containers, I think I agree with putting this in their configuration, especially as the resource system can already serve pre-gzipped static resources. |
Brian Clozel commented Let's close this issue for now, as this is much better supported by containers themselves. |
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 compressapplication/*+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 theview.render
call in theDispatcherServlet
. 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
The text was updated successfully, but these errors were encountered: