GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add HttpContentCompressor constructor with ability to specify desired… · netty/netty@61aca07

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-http/src/main/java/io/netty/handler/codec/http
    • HttpContentCompressor.java
    • HttpContentEncoder.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java‎

Copy file name to clipboardExpand all lines: codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,26 @@ public HttpContentCompressor(CompressionOptions... compressionOptions) {
185185
* if the default should be used.
186186
*/
187187
public HttpContentCompressor(int contentSizeThreshold, CompressionOptions... compressionOptions) {
188+
this(contentSizeThreshold, DEFAULT_MAX_PIPELINE_DEPTH, compressionOptions);
189+
}
190+
191+
/**
192+
* Create a new {@link HttpContentCompressor} instance with specified
193+
* {@link CompressionOptions}s
194+
*
195+
* @param contentSizeThreshold
196+
* The response body is compressed when the size of the response
197+
* body exceeds the threshold. The value should be a non negative
198+
* number. {@code 0} will enable compression for all responses.
199+
* @param maxPipelineDepth
200+
* The maximum allowed depth of the encoding pipeline queue, the default
201+
* value is set to {@link DEFAULT_MAX_PIPELINE_DEPTH}
202+
* @param compressionOptions {@link CompressionOptions} or {@code null}
203+
* if the default should be used.
204+
*/
205+
public HttpContentCompressor(int contentSizeThreshold, int maxPipelineDepth,
206+
CompressionOptions... compressionOptions) {
207+
super(maxPipelineDepth);
188208
this.contentSizeThreshold = ObjectUtil.checkPositiveOrZero(contentSizeThreshold, "contentSizeThreshold");
189209
BrotliOptions brotliOptions = null;
190210
GzipOptions gzipOptions = null;
Collapse file

‎codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java‎

Copy file name to clipboardExpand all lines: codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
* converts them into {@link ByteBuf}s.
5656
*/
5757
public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpRequest, HttpObject> {
58+
public static final int DEFAULT_MAX_PIPELINE_DEPTH = 128;
5859

5960
private enum State {
6061
PASS_THROUGH,
@@ -71,7 +72,7 @@ private enum State {
7172
private State state = State.AWAIT_HEADERS;
7273

7374
public HttpContentEncoder() {
74-
this(128);
75+
this(DEFAULT_MAX_PIPELINE_DEPTH);
7576
}
7677

7778
public HttpContentEncoder(int maxPipelineDepth) {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.