You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (ctx.pipeline().get(SslHandler.class) == null) {
ctx.write(newDefaultFileRegion(
file.getChannel(), 0, file.length()));
} else {
ctx.write(newChunkedNioFile(file.getChannel()));
}
ctx.pipeline().get(SslHandler.class) == null checks whether HTTPS is enabled.
The difference between new DefaultFileRegion(file.getChannel(), 0, file.length()) and new ChunkedNioFile((file.getChannel())) is that the previous one would use zero-copy optimization, which is beneficial to performance if possible.
But how shall the protocol(TLS or not) determine the usage of optimization?
The text was updated successfully, but these errors were encountered:
netty-in-action/chapter12/src/main/java/nia/chapter12/HttpRequestHandler.java
Lines 63 to 68 in 68e95e2
ctx.pipeline().get(SslHandler.class) == null
checks whether HTTPS is enabled.The difference between
new DefaultFileRegion(file.getChannel(), 0, file.length())
andnew ChunkedNioFile((file.getChannel()))
is that the previous one would use zero-copy optimization, which is beneficial to performance if possible.But how shall the protocol(TLS or not) determine the usage of optimization?
The text was updated successfully, but these errors were encountered: