Package io.micronaut.http.server.netty
Class DefaultHttpCompressionStrategy
java.lang.Object
io.micronaut.http.server.netty.DefaultHttpCompressionStrategy
- All Implemented Interfaces:
Toggleable
,HttpCompressionStrategy
@Internal
@Singleton
public final class DefaultHttpCompressionStrategy
extends Object
implements HttpCompressionStrategy
Default implementation of
HttpCompressionStrategy
.- Since:
- 1.2.0
- Author:
- James Kleeh
-
Method Summary
Modifier and TypeMethodDescriptionint
int
boolean
boolean
shouldCompress
(io.netty.handler.codec.http.HttpResponse response) boolean
shouldCompress
(io.netty.handler.codec.http.HttpResponse response, long contentLength)
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceToggleable
- Returns:
- Whether the component is enabled
-
shouldCompress
public boolean shouldCompress(io.netty.handler.codec.http.HttpResponse response) - Specified by:
shouldCompress
in interfaceHttpCompressionStrategy
- Parameters:
response
- The HTTP response- Returns:
- True if the response should be compressed
-
shouldCompress
public boolean shouldCompress(io.netty.handler.codec.http.HttpResponse response, long contentLength) -
getCompressionLevel
public int getCompressionLevel()- Specified by:
getCompressionLevel
in interfaceHttpCompressionStrategy
- Returns:
- The compression level (0-9)
-
getMaxZstdEncodeSize
public int getMaxZstdEncodeSize()- Specified by:
getMaxZstdEncodeSize
in interfaceHttpCompressionStrategy
- Returns:
- The maximum size of data that can be encoded using the zstd algorithm.
-