Merge pull request #987 from gianm/gzip-filter-taming

Disable checkGzExists in the default GzipFilter.
This commit is contained in:
xvrl 2014-12-22 10:43:14 -08:00
commit 2c533547c3
1 changed files with 15 additions and 6 deletions

View File

@ -31,17 +31,26 @@ public abstract class BaseJettyServerInitializer implements JettyServerInitializ
public static final String GZIP_METHODS = Joiner.on(",").join(HttpMethod.GET, HttpMethod.POST); public static final String GZIP_METHODS = Joiner.on(",").join(HttpMethod.GET, HttpMethod.POST);
public FilterHolder defaultGzipFilterHolder() { public FilterHolder defaultGzipFilterHolder()
{
final FilterHolder gzipFilterHolder = new FilterHolder(GzipFilter.class); final FilterHolder gzipFilterHolder = new FilterHolder(GzipFilter.class);
gzipFilterHolder.setInitParameter("minGzipSize", "0"); setDefaultGzipFilterHolderParameters(gzipFilterHolder);
gzipFilterHolder.setInitParameter("methods", GZIP_METHODS);
return gzipFilterHolder; return gzipFilterHolder;
} }
public FilterHolder defaultAsyncGzipFilterHolder() { public FilterHolder defaultAsyncGzipFilterHolder()
{
final FilterHolder gzipFilterHolder = new FilterHolder(AsyncGzipFilter.class); final FilterHolder gzipFilterHolder = new FilterHolder(AsyncGzipFilter.class);
gzipFilterHolder.setInitParameter("minGzipSize", "0"); setDefaultGzipFilterHolderParameters(gzipFilterHolder);
gzipFilterHolder.setInitParameter("methods", GZIP_METHODS);
return gzipFilterHolder; return gzipFilterHolder;
} }
private static void setDefaultGzipFilterHolderParameters(final FilterHolder filterHolder)
{
filterHolder.setInitParameter("minGzipSize", "0");
filterHolder.setInitParameter("methods", GZIP_METHODS);
// We don't actually have any precomputed .gz resources, and checking for them inside jars is expensive.
filterHolder.setInitParameter("checkGzExists", String.valueOf(false));
}
} }