Reputation: 167
I am using below code where I have added netty's HttpContentCompressor to compress the response coming out from my server. How ever when my server returns a response i.e. a string "test" HttpContentCompressor is not encoding it and returning it as test�.
I am already sending accept-encoding: zgip in the request! Have anyone faced this issue?
public void customize(NettyReactiveWebServerFactory factory) {
// Set Port and enable HTTP/2
factory.setPort(httpPort);
// HTTP 2.0 settings
if (isHTTP2Enabled) {
factory.addServerCustomizers(builder -> builder
.tcpConfiguration(tcpServer ->
tcpServer.doOnConnection((java.util.function.Consumer<Connection>)
connection -> {
connection.addHandler(connectionTerminator);
connection.addHandlerLast("decompressor",
new HttpContentDecompressor());
connection.addHandlerLast("compress",
new HttpContentCompressor(StandardCompressionOptions.gzip()));
connection.channel().pipeline();
}))
.protocol(HttpProtocol.H2C, HttpProtocol.HTTP11).http2Settings(http2SettingsBuilder -> {
http2SettingsBuilder.initialWindowSize(serverInitialWindowSize);
http2SettingsBuilder.maxConcurrentStreams(serverMaxConcurrentStreams);
}));
}
While putting a debug point in netty JdkZlibEncoder code I can see that code is returning without doing actual encoding:
Upvotes: 1
Views: 167