HttpContentDecompressor Class — netty Architecture
Architecture documentation for the HttpContentDecompressor class in HttpContentDecompressor.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD eb09ff63_3d95_c8b4_bb21_43753487497a["HttpContentDecompressor"] f5bc23a0_fed5_8812_1a9b_a0b78811dfb2["HttpContentDecompressor.java"] eb09ff63_3d95_c8b4_bb21_43753487497a -->|defined in| f5bc23a0_fed5_8812_1a9b_a0b78811dfb2 55b30208_f7fc_639c_3dfa_fdc949b10929["HttpContentDecompressor()"] eb09ff63_3d95_c8b4_bb21_43753487497a -->|method| 55b30208_f7fc_639c_3dfa_fdc949b10929 202dab4f_51dc_2e82_131f_60a2589457a6["EmbeddedChannel()"] eb09ff63_3d95_c8b4_bb21_43753487497a -->|method| 202dab4f_51dc_2e82_131f_60a2589457a6
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java lines 42–145
public class HttpContentDecompressor extends HttpContentDecoder {
private final boolean strict;
private final int maxAllocation;
/**
* Create a new {@link HttpContentDecompressor} in non-strict mode.
* @deprecated
* Use {@link HttpContentDecompressor#HttpContentDecompressor(int)}.
*/
@Deprecated
public HttpContentDecompressor() {
this(false, 0);
}
/**
* Create a new {@link HttpContentDecompressor} in non-strict mode.
* @param maxAllocation
* Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is not limited.
*/
public HttpContentDecompressor(int maxAllocation) {
this(false, maxAllocation);
}
/**
* Create a new {@link HttpContentDecompressor}.
*
* @param strict if {@code true} use strict handling of deflate if used, otherwise handle it in a
* more lenient fashion.
* @deprecated
* Use {@link HttpContentDecompressor#HttpContentDecompressor(boolean, int)}.
*/
@Deprecated
public HttpContentDecompressor(boolean strict) {
this(strict, 0);
}
/**
* Create a new {@link HttpContentDecompressor}.
*
* @param strict if {@code true} use strict handling of deflate if used, otherwise handle it in a
* more lenient fashion.
* @param maxAllocation
* Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is not limited.
*/
public HttpContentDecompressor(boolean strict, int maxAllocation) {
this.strict = strict;
this.maxAllocation = checkPositiveOrZero(maxAllocation, "maxAllocation");
}
@Override
protected EmbeddedChannel newContentDecoder(String contentEncoding) throws Exception {
Channel channel = ctx.channel();
if (GZIP.contentEqualsIgnoreCase(contentEncoding) ||
X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return EmbeddedChannel.builder()
.channelId(channel.id())
.hasDisconnect(channel.metadata().hasDisconnect())
.config(channel.config())
.handlers(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP, maxAllocation))
.build();
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) ||
X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
final ZlibWrapper wrapper = strict ? ZlibWrapper.ZLIB : ZlibWrapper.ZLIB_OR_NONE;
// To be strict, 'deflate' means ZLIB, but some servers were not implemented correctly.
return EmbeddedChannel.builder()
.channelId(channel.id())
.hasDisconnect(channel.metadata().hasDisconnect())
.config(channel.config())
.handlers(ZlibCodecFactory.newZlibDecoder(wrapper, maxAllocation))
.build();
}
if (Brotli.isAvailable() && BR.contentEqualsIgnoreCase(contentEncoding)) {
return EmbeddedChannel.builder()
.channelId(channel.id())
.hasDisconnect(channel.metadata().hasDisconnect())
.config(channel.config())
.handlers(new BrotliDecoder())
.build();
}
Source
Frequently Asked Questions
What is the HttpContentDecompressor class?
HttpContentDecompressor is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java.
Where is HttpContentDecompressor defined?
HttpContentDecompressor is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java at line 42.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free