use of io.undertow.server.handlers.encoding.GzipEncodingProvider in project undertow by undertow-io.
the class LoadBalancingProxyTestCase method setup.
@BeforeClass
public static void setup() throws URISyntaxException {
int port = DefaultServer.getHostPort("default");
server1 = Undertow.builder().addHttpListener(port + 1, DefaultServer.getHostAddress("default")).setSocketOption(Options.REUSE_ADDRESSES, true).setServerOption(UndertowOptions.NO_REQUEST_TIMEOUT, IDLE_TIMEOUT).setHandler(getRootHandler("s1", "server1")).build();
server2 = Undertow.builder().addHttpListener(port + 2, DefaultServer.getHostAddress("default")).setSocketOption(Options.REUSE_ADDRESSES, true).setServerOption(UndertowOptions.NO_REQUEST_TIMEOUT, IDLE_TIMEOUT).setHandler(getRootHandler("s2", "server2")).build();
server1.start();
server2.start();
ProxyHandler handler = new ProxyHandler(new LoadBalancingProxyClient().setConnectionsPerThread(4).addHost(new URI("http", null, DefaultServer.getHostAddress("default"), port + 1, null, null, null), "s1").addHost(new URI("http", null, DefaultServer.getHostAddress("default"), port + 2, null, null, null), "s2"), 10000, ResponseCodeHandler.HANDLE_404, false, false, 2);
DefaultServer.setRootHandler(new EncodingHandler(handler, new ContentEncodingRepository().addEncodingHandler("gzip", new GzipEncodingProvider(), 50, Predicates.truePredicate())));
}
use of io.undertow.server.handlers.encoding.GzipEncodingProvider in project spring-boot by spring-projects.
the class UndertowServletWebServer method configurationCompressionIfNecessary.
private HttpHandler configurationCompressionIfNecessary(HttpHandler httpHandler) {
if (this.compression == null || !this.compression.getEnabled()) {
return httpHandler;
}
ContentEncodingRepository repository = new ContentEncodingRepository();
repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50, Predicates.and(getCompressionPredicates(this.compression)));
return new EncodingHandler(repository).setNext(httpHandler);
}
use of io.undertow.server.handlers.encoding.GzipEncodingProvider in project wildfly by wildfly.
the class GzipFilter method createHttpHandler.
@Override
public HttpHandler createHttpHandler(final Predicate predicate, ModelNode model, HttpHandler next) {
EncodingHandler encodingHandler = new EncodingHandler(new ContentEncodingRepository().addEncodingHandler("gzip", new GzipEncodingProvider(), 50, predicate != null ? predicate : Predicates.truePredicate()));
encodingHandler.setNext(next);
return encodingHandler;
}
Aggregations