Search in sources :

Example 6 with GzipHandler

use of org.eclipse.jetty.server.handler.gzip.GzipHandler in project async-http-client by AsyncHttpClient.

the class EofTerminatedTest method configureHandler.

@Override
public AbstractHandler configureHandler() throws Exception {
    GzipHandler gzipHandler = new GzipHandler();
    gzipHandler.setHandler(new StreamHandler());
    return gzipHandler;
}
Also used : GzipHandler(org.eclipse.jetty.server.handler.gzip.GzipHandler)

Example 7 with GzipHandler

use of org.eclipse.jetty.server.handler.gzip.GzipHandler in project druid by druid-io.

the class JettyServerInitUtils method wrapWithDefaultGzipHandler.

public static GzipHandler wrapWithDefaultGzipHandler(final Handler handler) {
    GzipHandler gzipHandler = new GzipHandler();
    gzipHandler.setMinGzipSize(0);
    gzipHandler.setIncludedMethods(GZIP_METHODS);
    // We don't actually have any precomputed .gz resources, and checking for them inside jars is expensive.
    gzipHandler.setCheckGzExists(false);
    gzipHandler.setHandler(handler);
    return gzipHandler;
}
Also used : GzipHandler(org.eclipse.jetty.server.handler.gzip.GzipHandler)

Example 8 with GzipHandler

use of org.eclipse.jetty.server.handler.gzip.GzipHandler in project jetty.project by eclipse.

the class ServletContextHandlerTest method testGzipHandlerSet.

@Test
public void testGzipHandlerSet() throws Exception {
    ServletContextHandler context = new ServletContextHandler();
    context.setSessionHandler(new SessionHandler());
    context.setGzipHandler(new GzipHandler());
    GzipHandler gzip = context.getGzipHandler();
    _server.start();
    assertEquals(context.getSessionHandler(), context.getHandler());
    assertEquals(gzip, context.getSessionHandler().getHandler());
    assertEquals(context.getServletHandler(), gzip.getHandler());
}
Also used : SessionHandler(org.eclipse.jetty.server.session.SessionHandler) GzipHandler(org.eclipse.jetty.server.handler.gzip.GzipHandler) Test(org.junit.Test)

Example 9 with GzipHandler

use of org.eclipse.jetty.server.handler.gzip.GzipHandler in project jetty.project by eclipse.

the class GzipHandlerTest method testAddGetPaths.

@Test
public void testAddGetPaths() {
    GzipHandler gzip = new GzipHandler();
    gzip.addIncludedPaths("/foo");
    gzip.addIncludedPaths("^/bar.*$");
    String[] includedPaths = gzip.getIncludedPaths();
    assertThat("Included Paths.size", includedPaths.length, is(2));
    assertThat("Included Paths", Arrays.asList(includedPaths), contains("/foo", "^/bar.*$"));
}
Also used : GzipHandler(org.eclipse.jetty.server.handler.gzip.GzipHandler) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 10 with GzipHandler

use of org.eclipse.jetty.server.handler.gzip.GzipHandler in project spring-boot by spring-projects.

the class JettyServletWebServerFactory method createGzipHandler.

private HandlerWrapper createGzipHandler() {
    GzipHandler handler = new GzipHandler();
    Compression compression = getCompression();
    handler.setMinGzipSize(compression.getMinResponseSize());
    handler.setIncludedMimeTypes(compression.getMimeTypes());
    if (compression.getExcludedUserAgents() != null) {
        handler.setExcludedAgentPatterns(compression.getExcludedUserAgents());
    }
    return handler;
}
Also used : Compression(org.springframework.boot.web.server.Compression) GzipHandler(org.eclipse.jetty.server.handler.gzip.GzipHandler)

Aggregations

GzipHandler (org.eclipse.jetty.server.handler.gzip.GzipHandler)11 Server (org.eclipse.jetty.server.Server)4 Test (org.junit.Test)3 Handler (org.eclipse.jetty.server.Handler)2 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)2 ServerConnector (org.eclipse.jetty.server.ServerConnector)2 HandlerList (org.eclipse.jetty.server.handler.HandlerList)2 SessionHandler (org.eclipse.jetty.server.session.SessionHandler)2 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 GuiceFilter (com.google.inject.servlet.GuiceFilter)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1 Random (java.util.Random)1 DispatcherType (javax.servlet.DispatcherType)1 Filter (javax.servlet.Filter)1 SolrDispatchFilter (org.apache.solr.servlet.SolrDispatchFilter)1 ConstraintSecurityHandler (org.eclipse.jetty.security.ConstraintSecurityHandler)1 SecurityHandler (org.eclipse.jetty.security.SecurityHandler)1 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)1