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 Details

    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Toggleable
      Returns:
      Whether the component is enabled
    • shouldCompress

      public boolean shouldCompress(io.netty.handler.codec.http.HttpResponse response)
      Specified by:
      shouldCompress in interface HttpCompressionStrategy
      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 interface HttpCompressionStrategy
      Returns:
      The compression level (0-9)
    • getMaxZstdEncodeSize

      public int getMaxZstdEncodeSize()
      Specified by:
      getMaxZstdEncodeSize in interface HttpCompressionStrategy
      Returns:
      The maximum size of data that can be encoded using the zstd algorithm.