Disable checkGzExists in the default GzipFilter.

It is unhelpful because we don't actually have any precomputed .gz resources,
and checking for them inside jars is expensive.
This commit is contained in:
Gian Merlino 2014-12-21 09:19:21 -08:00
parent 6ebf0bd62a
commit badc09e85c
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 FilterHolder defaultGzipFilterHolder() {
public FilterHolder defaultGzipFilterHolder()
{
final FilterHolder gzipFilterHolder = new FilterHolder(GzipFilter.class);
gzipFilterHolder.setInitParameter("minGzipSize", "0");
gzipFilterHolder.setInitParameter("methods", GZIP_METHODS);
setDefaultGzipFilterHolderParameters(gzipFilterHolder);
return gzipFilterHolder;
}
public FilterHolder defaultAsyncGzipFilterHolder() {
public FilterHolder defaultAsyncGzipFilterHolder()
{
final FilterHolder gzipFilterHolder = new FilterHolder(AsyncGzipFilter.class);
gzipFilterHolder.setInitParameter("minGzipSize", "0");
gzipFilterHolder.setInitParameter("methods", GZIP_METHODS);
setDefaultGzipFilterHolderParameters(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));
}
}