Class CompressionConfig
java.lang.Object
io.vertx.core.http.CompressionConfig
HTTP compression configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCallsaddCompressor(CompressionOptions)with the brotli algorithm configured with default parameters.addBrotli(int quality) CallsaddCompressor(CompressionOptions)with the brotli algorithm configured with the specifiedquality, default window and default mode.addCompressor(CompressionOptions compressor) Add a compressor, if the compressor is already registered, the compressor is updated instead.CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with default parameters.addDeflate(int compressionLevel) CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with the specifiedcompressionLevel, default window bits and default mem level.addDeflate(int compressionLevel, int windowBits, int memLevel) CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with the specifiedcompressionLevel, specifiedwindowBitsand specifiedmemLevel.addGzip()CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with default parameters.addGzip(int compressionLevel) CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with the specifiedcompressionLevel, default window bits and default mem level.addGzip(int compressionLevel, int windowBits, int memLevel) CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with the specifiedcompressionLevel, specifiedwindowBitsand specifiedmemLevel.CallsaddCompressor(CompressionOptions)with the snappy algorithm configured with default parameters.addZstd()CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with default parameters.addZstd(int compressionLevel) CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with the specifiedcompressionLevel, default block size and default max encode size.addZstd(int compressionLevel, int blockSize, int maxEncodeSize) CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with the specifiedcompressionLevel, specifiedblockSizeand specifiedmaxEncodeSize.intbooleanbooleansetCompressionEnabled(boolean compressionEnabled) Set whether the server should support gzip/deflate compression (serving compressed responses to clients advertising support for them with Accept-Encoding header)setCompressors(List<CompressionOptions> compressors) Set the list of compressors.setContentSizeThreshold(int contentSizeThreshold) Set the compression content size threshold if compression is enabled.setDecompressionEnabled(boolean decompressionEnabled) Set whether the server supports decompression
-
Constructor Details
-
CompressionConfig
public CompressionConfig() -
CompressionConfig
-
-
Method Details
-
isCompressionEnabled
public boolean isCompressionEnabled()- Returns:
trueif the server supports gzip/deflate compression
-
setCompressionEnabled
Set whether the server should support gzip/deflate compression (serving compressed responses to clients advertising support for them with Accept-Encoding header)- Parameters:
compressionEnabled-trueto enable compression support- Returns:
- a reference to this, so the API can be used fluently
-
isDecompressionEnabled
public boolean isDecompressionEnabled()- Returns:
trueif the server supports decompression
-
setDecompressionEnabled
Set whether the server supports decompression- Parameters:
decompressionEnabled-trueif decompression supported- Returns:
- a reference to this, so the API can be used fluently
-
getContentSizeThreshold
public int getContentSizeThreshold()- Returns:
- the compression content size threshold
-
setContentSizeThreshold
Set the compression content size threshold if compression is enabled. This is only applicable for HTTP/1.x response bodies. If the response content size in bytes is greater than this threshold, then the response is compressed. Otherwise, it is not compressed.- Parameters:
contentSizeThreshold- integer greater than or equal to 0.- Returns:
- a reference to this, so the API can be used fluently
-
getCompressors
- Returns:
- the list of compressor to use
-
setCompressors
Set the list of compressors.- Parameters:
compressors- the list of compressors- Returns:
- a reference to this, so the API can be used fluently
-
addCompressor
Add a compressor, if the compressor is already registered, the compressor is updated instead.- Returns:
- a reference to this, so the API can be used fluently
-
addGzip
CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with default parameters.- Returns:
- a reference to this, so the API can be used fluently
-
addGzip
CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with the specifiedcompressionLevel, default window bits and default mem level.- Parameters:
compressionLevel- the compression level, ranged from 1 to 9- Returns:
- a reference to this, so the API can be used fluently
-
addGzip
CallsaddCompressor(CompressionOptions)with the gzip algorithm configured with the specifiedcompressionLevel, specifiedwindowBitsand specifiedmemLevel.- Parameters:
compressionLevel- the compression level param, ranged from 1 to 9windowBits- the window bits parammemLevel- the mem level param- Returns:
- a reference to this, so the API can be used fluently
-
addDeflate
CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with default parameters.- Returns:
- a reference to this, so the API can be used fluently
-
addDeflate
CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with the specifiedcompressionLevel, default window bits and default mem level.- Returns:
- a reference to this, so the API can be used fluently
-
addDeflate
CallsaddCompressor(CompressionOptions)with the deflate algorithm configured with the specifiedcompressionLevel, specifiedwindowBitsand specifiedmemLevel.- Parameters:
compressionLevel- the compression level param, ranged from 1 to 9windowBits- the window bits parammemLevel- the mem level param- Returns:
- a reference to this, so the API can be used fluently
-
addSnappy
CallsaddCompressor(CompressionOptions)with the snappy algorithm configured with default parameters.- Returns:
- a reference to this, so the API can be used fluently
-
addZstd
CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with default parameters.- Returns:
- a reference to this, so the API can be used fluently
-
addZstd
CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with the specifiedcompressionLevel, default block size and default max encode size.- Parameters:
compressionLevel- the compression level param- Returns:
- a reference to this, so the API can be used fluently
-
addZstd
CallsaddCompressor(CompressionOptions)with the zstd algorithm configured with the specifiedcompressionLevel, specifiedblockSizeand specifiedmaxEncodeSize.- Parameters:
compressionLevel- the compression level paramblockSize- the block size parammaxEncodeSize- the max encode size param- Returns:
- a reference to this, so the API can be used fluently
-
addBrotli
CallsaddCompressor(CompressionOptions)with the brotli algorithm configured with default parameters.- Returns:
- a reference to this, so the API can be used fluently
-
addBrotli
CallsaddCompressor(CompressionOptions)with the brotli algorithm configured with the specifiedquality, default window and default mode.- Parameters:
quality- the quality param- Returns:
- a reference to this, so the API can be used fluently
-