I want to serve brotli compressed static files from tomcat DefaultServlet if the browser supports it. They are about 15% smaller than the gzip files. I created a pull request for the feature: https://github.com/apache/tomcat/pull/28 The feature is quite generic, but it does not yet have any way to configure the list compression formats using DefaultServlet parameters. That can be added later if we want to support other compression formats.
A few thoughts: 1. This is interesting (Brotli) 2. This pull request has very little Brotli-specific stuff in it (just a unit test that exercises the generic "precompressed" refactoring introduced here) 3. It is forward-compatible with other compression algorithms with obvious filename extensions I'm +1 on this pull request. I'd like some other feedback, though, first.
Oh, another thing: there are no license issues, here, since although Brotli has a (modified?) MIT license (and I'm not clear on its compatibility with AL2), there is no specific support for the algorithm: it's merely detecting the presence of a precompressed file using its filename extension and providing the appropriate Content-Encoding response header.
I updated the pull request a week ago based on feedback from markt-asf. Changes: - possibility to configure the list of precompressed file types for default servlet - parsing accept-encoding header according to RFC7231 (the current functionality in tomcat serves gzip even if explicitly disabled with accept-encoding:gzip;q=0) What would be the process for accepting this feature?
Thanks for the updated patch. It looks great. I've applied it to 9.0.x and it will be included in 9.0.0.M4 onwards.