Class RequestDecompressionPolicy.Builder
java.lang.Object
com.soklet.RequestDecompressionPolicy.Builder
- Enclosing class:
RequestDecompressionPolicy
Builder for enabled
RequestDecompressionPolicy instances.- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an enabledRequestDecompressionPolicy.maximumCompressionRatio(@Nullable Integer maximumCompressionRatio) Sets the maximum permitted expansion ratio between decompressed and compressed body sizes, ornullfor the default of100.maximumDecompressedBodySizeInBytes(@Nullable Integer maximumDecompressedBodySizeInBytes) Sets the maximum permitted decompressed body size in bytes, ornullto use the server'smaximumRequestSizeInBytes.
-
Method Details
-
maximumDecompressedBodySizeInBytes
public @NonNull RequestDecompressionPolicy.Builder maximumDecompressedBodySizeInBytes(@Nullable Integer maximumDecompressedBodySizeInBytes) Sets the maximum permitted decompressed body size in bytes, ornullto use the server'smaximumRequestSizeInBytes.- Parameters:
maximumDecompressedBodySizeInBytes- the maximum decompressed body size, ornullfor the server default- Returns:
- this builder
-
maximumCompressionRatio
public @NonNull RequestDecompressionPolicy.Builder maximumCompressionRatio(@Nullable Integer maximumCompressionRatio) Sets the maximum permitted expansion ratio between decompressed and compressed body sizes, ornullfor the default of100. Must be between1and10_000; the upper bound keeps ratio arithmetic safely withinlongrange for any legal body size (gzip's theoretical maximum expansion is roughly1032:1).- Parameters:
maximumCompressionRatio- the maximum compression ratio, ornullfor the default- Returns:
- this builder
-
build
Builds an enabledRequestDecompressionPolicy.- Returns:
- the request decompression policy
- Throws:
IllegalArgumentException- if a limit is zero or negative
-