@Override public HandlerWrapper createGzipHandler(Compression compression) { GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setMinGzipSize(compression.getMinResponseSize()); gzipHandler.addIncludedMimeTypes(compression.getMimeTypes()); if (compression.getExcludedUserAgents() != null) { gzipHandler.setExcluded(new HashSet<String>( Arrays.asList(compression.getExcludedUserAgents()))); } return gzipHandler; }
@Override public HandlerWrapper createGzipHandler(Compression compression) { GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setMinGzipSize(compression.getMinResponseSize()); gzipHandler.setMimeTypes( new HashSet<String>(Arrays.asList(compression.getMimeTypes()))); if (compression.getExcludedUserAgents() != null) { gzipHandler.setExcluded(new HashSet<String>( Arrays.asList(compression.getExcludedUserAgents()))); } return gzipHandler; }
@Override public Object customizeContext(Object context, Dictionary<String, ?> settings) { if (context instanceof ContextHandler) { final GzipHandler gzipHandler = new CustomLevelGzipHandler(Deflater.BEST_COMPRESSION); gzipHandler.setBufferSize(16384); final ContextHandler contextHandler = (ContextHandler)context; contextHandler.setHandler(gzipHandler); } return super.customizeContext(context, settings); }
public AssetsContextHandler(SystemEnvironment systemEnvironment) throws IOException { super(systemEnvironment.getWebappContextPath() + "/assets"); this.systemEnvironment = systemEnvironment; handler = new AssetsHandler(); GzipHandler gzipHandler = new GzipHandler(); gzipHandler.addIncludedMimeTypes("text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml,application/vnd.go.cd.v1+json,application/json"); gzipHandler.setHandler(handler); setHandler(gzipHandler); }