|Summary:||[patch] support gzipped versions of static resources by DefaultServlet|
|Product:||Tomcat 8||Reporter:||Philippe Marschall <kustos>|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
|Attachments:||patch that supports gzipped versions of files|
Description Philippe Marschall 2012-11-03 20:49:45 UTC
Created attachment 29546 [details] patch that supports gzipped versions of files If you want to serve gzipped versions of files you often use a filter, valve or enable compression attribute on the connector. However this is suboptimal for several reasons. Compression has to be done in memory so the whole content has to be loaded into memory, the result is not cached meaning compression has to be done over agin and sendfile can't be used. The most efficient way to implement gzip serving to generate gzipped versions of the resources at build time. Then use a custom filter that forwards to the gzipped version if the user agent supports it. This way sendfile can be used and compression is only done once at build time. It would be nice if the DefaultServlet detected that there's a gzipped version of the resource and serves it when the client supports it. The Jetty DefaultServlet does exactly this: http://download.eclipse.org/jetty/stable-8/apidocs/org/eclipse/jetty/servlet/DefaultServlet.html Patch attached with tests and updated documentation.
Comment 1 Mark Thomas 2013-10-10 21:25:23 UTC
Thanks for the feature suggestion and the patch. This has been added to 8.0.x and will be included in 8.0.0-RC4 onwards.