@Internal public class SmartHttpContentCompressor extends io.netty.handler.codec.http.HttpContentCompressor
HttpContentCompressor
that skips encoding if the content type is not compressible or if
the content is too small.Constructor and Description |
---|
SmartHttpContentCompressor()
Creates a SmartHttpContentCompressor with the default compression threshold.
|
Modifier and Type | Method and Description |
---|---|
protected io.netty.handler.codec.http.HttpContentEncoder.Result |
beginEncode(io.netty.handler.codec.http.HttpResponse headers,
String acceptEncoding) |
protected void |
encode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpObject msg,
List<Object> out) |
boolean |
shouldSkip(io.netty.handler.codec.http.HttpHeaders headers)
Determines if encoding should occur based on the content type and length.
|
boolean |
shouldSkip(String contentType,
Integer contentLength)
Determines if encoding should occur based on the content type and length.
|
determineWrapper, handlerAdded
acceptOutboundMessage, channelInactive, decode, handlerRemoved
acceptInboundMessage, channelRead, write
bind, close, connect, deregister, disconnect, flush, read
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
@Internal public SmartHttpContentCompressor()
SmartHttpContentCompressor(int)
public boolean shouldSkip(@Nullable String contentType, @Nullable Integer contentLength)
contentType
- The content typecontentLength
- The content lengthpublic boolean shouldSkip(io.netty.handler.codec.http.HttpHeaders headers)
headers
- The headers that contain the content type and lengthprotected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) throws Exception
encode
in class io.netty.handler.codec.http.HttpContentEncoder
Exception