Class CompressionConfig.Builder

java.lang.Object
org.eclipse.jetty.compression.server.CompressionConfig.Builder
Enclosing class:
CompressionConfig

public static class CompressionConfig.Builder extends Object

The builder of CompressionConfig immutable instances.

Notes about PathSpec strings

There are 2 syntaxes supported, Servlet url-pattern based, and regex based.

  • If the spec starts with '^' the spec is assumed to be a regex based path spec and will match with normal Java regex rules.
  • If the spec starts with '/' then spec is assumed to be a Servlet url-pattern rules path spec for either an exact match or prefix based match.
  • If the spec starts with '*.' then spec is assumed to be a Servlet url-pattern rules path spec for a suffix based match.
  • All other syntaxes are unsupported

For all properties, exclusion takes precedence over inclusion, as defined by IncludeExcludeSet.

  • Method Details

    • compressExcludeEncoding

      public CompressionConfig.Builder compressExcludeEncoding(String encoding)
      Parameters:
      encoding - the encoding to exclude for response compression.
      Returns:
      this builder
    • compressExcludeMethod

      public CompressionConfig.Builder compressExcludeMethod(String method)
      Parameters:
      method - the HTTP method to exclude for response compression
      Returns:
      this builder
    • compressExcludeMimeType

      public CompressionConfig.Builder compressExcludeMimeType(String mimetype)
      Parameters:
      mimetype - the MIME type to exclude for response compression
      Returns:
      this builder
    • compressExcludePath

      public CompressionConfig.Builder compressExcludePath(String pathSpecString)

      A path spec to exclude for response compression.

      The path spec is matched against Request.getPathInContext(Request).

      Parameters:
      pathSpecString - the path spec to exclude for response compression.
      Returns:
      this builder
      See Also:
    • compressIncludeEncoding

      public CompressionConfig.Builder compressIncludeEncoding(String encoding)
      Parameters:
      encoding - the encoding to include for response compression.
      Returns:
      this builder
    • compressIncludeMethod

      public CompressionConfig.Builder compressIncludeMethod(String method)
      Parameters:
      method - the HTTP method to include for response compression
      Returns:
      this builder
    • compressIncludeMimeType

      public CompressionConfig.Builder compressIncludeMimeType(String mimetype)
      Parameters:
      mimetype - the MIME type to include for response compression
      Returns:
      this builder
    • compressIncludePath

      public CompressionConfig.Builder compressIncludePath(String pathSpecString)

      A path spec to include for response compression.

      The path spec is matched against Request.getPathInContext(Request).

      Parameters:
      pathSpecString - the path spec to include for response compression.
      Returns:
      this builder
      See Also:
    • compressPreferredEncodings

      public CompressionConfig.Builder compressPreferredEncodings(List<String> encodings)

      Specifies a list of encodings for response compression in preferred order.

      This list is only used when CompressionHandler computes more than one candidate content encoding for response compression. This happens only when Accept-Encoding specifies more than one encoding, and they are all supported by the server, or when Accept-Encoding specifies the token * and the server supports more than one encoding.

      Parameters:
      encodings - a list of encodings for response compression in preferred order
      Returns:
      this builder
    • decompressExcludeEncoding

      public CompressionConfig.Builder decompressExcludeEncoding(String encoding)
      Parameters:
      encoding - the encoding to exclude for request decompression
      Returns:
      this builder
    • decompressExcludeMethod

      public CompressionConfig.Builder decompressExcludeMethod(String method)
      Parameters:
      method - the HTTP method to exclude for request decompression
      Returns:
      this builder
    • decompressExcludeMimeType

      public CompressionConfig.Builder decompressExcludeMimeType(String mimetype)
      Parameters:
      mimetype - the MIME type to exclude for request decompression
      Returns:
      this builder
    • decompressExcludePath

      public CompressionConfig.Builder decompressExcludePath(String pathSpecString)

      A path spec to exclude for request decompression.

      The path spec is matched against Request.getPathInContext(Request).

      Parameters:
      pathSpecString - the path spec to exclude for request decompression
      Returns:
      this builder
      See Also:
    • decompressIncludeEncoding

      public CompressionConfig.Builder decompressIncludeEncoding(String encoding)
      Parameters:
      encoding - the encoding to include for request decompression
      Returns:
      this builder
    • decompressIncludeMethod

      public CompressionConfig.Builder decompressIncludeMethod(String method)
      Parameters:
      method - the HTTP method to include for request decompression
      Returns:
      this builder
    • decompressIncludeMimeType

      public CompressionConfig.Builder decompressIncludeMimeType(String mimetype)
      Parameters:
      mimetype - the MIME type to include for request decompression
      Returns:
      this builder
    • decompressIncludePath

      public CompressionConfig.Builder decompressIncludePath(String pathSpecString)

      A path spec to include for request decompression.

      The path spec is matched against Request.getPathInContext(Request).

      Parameters:
      pathSpecString - the path spec to include for request decompression
      Returns:
      this builder
      See Also:
    • defaults

      public CompressionConfig.Builder defaults()

      Configures this Builder with the default configuration.

      Additional configuration may be specified using the Builder methods, possibly overriding the defaults.

      Returns:
      this builder
    • build

      public CompressionConfig build()
      Returns:
      a new CompressionConfig instance configured with this Builder.