Class AcceptEncoding

java.lang.Object
io.helidon.http.encoding.AcceptEncoding

public final class AcceptEncoding extends Object
Parsed Accept-Encoding header values and quality matching.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

  • Field Details

  • Method Details

    • create

      public static AcceptEncoding create(Headers headers)
      Parse Accept-Encoding from headers.
      Parameters:
      headers - headers
      Returns:
      parsed accept encoding
    • present

      public boolean present()
      Whether the header was present.
      Returns:
      whether Accept-Encoding was present
    • valid

      public boolean valid()
      Whether parsing did not encounter malformed values.
      Returns:
      whether parsed values are valid
    • match

      public Optional<AcceptEncoding.CodingQuality> match(String coding, boolean wildcardAllowed)
      Match a content coding.
      Parameters:
      coding - concrete or wildcard coding
      wildcardAllowed - whether wildcard may match the coding
      Returns:
      coding quality if the coding is acceptable, otherwise empty
    • identity

      Match identity.
      Returns:
      coding quality if identity is acceptable
    • acceptedCodings

      public List<AcceptEncoding.CodingQuality> acceptedCodings(boolean wildcardAllowed)
      Accepted non-identity coding qualities from this header.
      Parameters:
      wildcardAllowed - whether wildcard should be included
      Returns:
      immutable accepted non-identity coding qualities
    • best

      Select the best runtime encoding from the available codings.

      Equal-quality concrete codings use the client header order, with the provided coding order as a fallback for wildcard and otherwise equivalent matches.

      Parameters:
      codings - available concrete codings in fallback order
      Returns:
      best coding, identity, or empty if none is acceptable