static GzipHandler gzipHandler() { GzipHandler gzipHandler = new GzipHandler(); gzipHandler.addIncludedMimeTypes( "application/javascript", "application/json", "application/vnd.go.cd.v1+json", "application/vnd.go.cd.v2+json", "application/vnd.go.cd.v3+json", "application/vnd.go.cd.v4+json", "application/vnd.go.cd.v5+json", "application/vnd.go.cd.v6+json", "application/vnd.go.cd.v7+json", "application/vnd.go.cd.v8+json", "application/vnd.go.cd.v9+json", "application/xhtml+xml", "image/svg+xml", "text/css", "text/html", "text/plain", "text/xml" ); gzipHandler.addIncludedMethods("HEAD", "GET", "POST", "PUT", "PATCH", "DELETE"); return gzipHandler; }
final GzipHandler gzipHandler = context.getGzipHandler(); gzipHandler.addIncludedPaths("/*"); gzipHandler.addIncludedMethods(HttpMethod.POST.asString());
gzipHandler.addIncludedMethods("GET","POST"); gzipHandler.setIncludedPaths("/*");
final GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setHandler(context); gzipHandler.addIncludedMethods(HttpMethod.POST); gzipHandler.addIncludedMimeTypes(APPLICATION_THRIFT); server.setHandler(gzipHandler);
static HandlerWrapper createGzipHandlerWrapper(Compression compression) { GzipHandler handler = new GzipHandler(); handler.setMinGzipSize((int) compression.getMinResponseSize().toBytes()); handler.setIncludedMimeTypes(compression.getMimeTypes()); for (HttpMethod httpMethod : HttpMethod.values()) { handler.addIncludedMethods(httpMethod.name()); } if (compression.getExcludedUserAgents() != null) { handler.setExcludedAgentPatterns(compression.getExcludedUserAgents()); } return handler; }
@Override public void customize(final Server server) { try { Class.forName("org.eclipse.jetty.server.handler.gzip.GzipHandler"); } catch (final ClassNotFoundException ignored) { log.debug("org.eclipse.jetty.server.handler.gzip.GzipHandler is not in classpath.", ignored); return; } final HandlerCollection handlers = new HandlerCollection(); final GzipHandler gzipHandler = new GzipHandler(); gzipHandler.addIncludedMethods(HttpMethod.GET.asString(), HttpMethod.POST.asString(), HttpMethod.PUT.asString(), HttpMethod.DELETE.asString()); gzipHandler.setCompressionLevel(5); handlers.addHandler(gzipHandler); asList(server.getHandlers()).forEach(handlers::addHandler); server.setHandler(handlers); } }
@Override public void customize(final Server server) { try { Class.forName("org.eclipse.jetty.server.handler.gzip.GzipHandler"); } catch (final ClassNotFoundException ignored) { log.debug("org.eclipse.jetty.server.handler.gzip.GzipHandler is not in classpath.", ignored); return; } final HandlerCollection handlers = new HandlerCollection(); final GzipHandler gzipHandler = new GzipHandler(); gzipHandler.addIncludedMethods(HttpMethod.GET.asString(), HttpMethod.POST.asString(), HttpMethod.PUT.asString(), HttpMethod.DELETE.asString()); gzipHandler.setCompressionLevel(5); handlers.addHandler(gzipHandler); asList(server.getHandlers()).forEach(handlers::addHandler); server.setHandler(handlers); } }
final GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setHandler(context); gzipHandler.addIncludedMethods(HttpMethod.POST); gzipHandler.addIncludedMimeTypes(APPLICATION_THRIFT); server.setHandler(gzipHandler);
gzipHandler.setSyncFlush(this.config.isGzipSyncFlush()); gzipHandler.addExcludedAgentPatterns(this.config.getGzipExcludedUserAgent()); gzipHandler.addIncludedMethods(this.config.getGzipIncludedMethods()); gzipHandler.addExcludedMethods(this.config.getGzipExcludedMethods()); gzipHandler.addIncludedPaths(this.config.getGzipIncludedPaths());