javaee / grizzly

Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API.
https://javaee.github.io/grizzly/
Other
222 stars 60 forks source link

Enabling http2 stops gzip compression #1993

Closed rroller closed 6 years ago

rroller commented 6 years ago

When I enabled http2, content is no longer gzip compressed.

Versions: 2.4.3

Here's an example configuation...

final WebappContext context = new WebappContext("myservice", "");
final boolean start = false;

// Create the server
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, start);
final NetworkListener listener = server.getListeners().iterator().next();

// Configure SSL
final SSLEngineConfigurator sslConfig = getSslConfig(config);
listener.setSecure(true);
listener.setSSLEngineConfig(sslConfig);

// Create default HTTP/2 configuration and provide it to the AddOn
final Http2Configuration configuration = Http2Configuration.builder().build();
final Http2AddOn http2Addon = new Http2AddOn(configuration);
listener.registerAddOn(http2Addon); // This will break gzip

...

// Gzip compression
final CompressionConfig compression = listener.getCompressionConfig();
compression.setCompressionMode(CompressionConfig.CompressionMode.ON);
compression.setCompressionMinSize(1);
compression.setCompressibleMimeTypes(ImmutableSet.<String> builder()
.add("text/plain")
.add("text/html")
.add("text/css")
.add("text/javascript")
.build());

context.deploy(server);

return server;
glassfishrobot commented 6 years ago

Closing this as this issue is migrated to https://github.com/eclipse-ee4j/grizzly/issues/1993