Class EncodingNegotiator


  • public final class EncodingNegotiator
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      EncodingNegotiator​(scala.collection.immutable.Seq<HttpHeader> requestHeaders)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      scala.collection.immutable.List<HttpEncodingRange> acceptedEncodingRanges()
      The encoding-ranges accepted by the client according to given request headers, sorted by 1. increasing generality (i.e. most specific first) 2. decreasing q-value (only for ranges targeting a single HttpEncoding) 3. order of appearance in the Accept-Encoding header(s)
      static EncodingNegotiator apply​(scala.collection.immutable.Seq<HttpHeader> requestHeaders)  
      boolean hasMatchingFor​(HttpEncoding encoding)
      Determines whether the request has an Accept-Encoding clause matching the given encoding.
      boolean isAccepted​(HttpEncoding encoding)
      Determines whether the given encoding is accepted by the client.
      scala.Option<HttpEncoding> pickEncoding​(scala.collection.immutable.List<HttpEncoding> alternatives)
      Picks the best of the given encoding alternatives given the preferences the client indicated in the request's Accept-Encoding headers.
      float qValueFor​(HttpEncoding encoding)
      Returns the q-value that the client (implicitly or explicitly) attaches to the given encoding.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EncodingNegotiator

        public EncodingNegotiator​(scala.collection.immutable.Seq<HttpHeader> requestHeaders)
    • Method Detail

      • acceptedEncodingRanges

        public scala.collection.immutable.List<HttpEncodingRange> acceptedEncodingRanges()
        The encoding-ranges accepted by the client according to given request headers, sorted by 1. increasing generality (i.e. most specific first) 2. decreasing q-value (only for ranges targeting a single HttpEncoding) 3. order of appearance in the Accept-Encoding header(s)
        Returns:
        (undocumented)
      • qValueFor

        public float qValueFor​(HttpEncoding encoding)
        Returns the q-value that the client (implicitly or explicitly) attaches to the given encoding. See http://tools.ietf.org/html/rfc7231#section-5.3.1 for details.
        Parameters:
        encoding - (undocumented)
        Returns:
        (undocumented)
      • isAccepted

        public boolean isAccepted​(HttpEncoding encoding)
        Determines whether the given encoding is accepted by the client.
        Parameters:
        encoding - (undocumented)
        Returns:
        (undocumented)
      • hasMatchingFor

        public boolean hasMatchingFor​(HttpEncoding encoding)
        Determines whether the request has an Accept-Encoding clause matching the given encoding.
        Parameters:
        encoding - (undocumented)
        Returns:
        (undocumented)
      • pickEncoding

        public scala.Option<HttpEncoding> pickEncoding​(scala.collection.immutable.List<HttpEncoding> alternatives)
        Picks the best of the given encoding alternatives given the preferences the client indicated in the request's Accept-Encoding headers. See http://tools.ietf.org/html/rfc7231#section-5.3.4 for details on the negotiation logic.

        If there are several best encoding alternatives that the client has equal preference for the order of the given alternatives is used as a tie breaker (first one wins).

        If none of the given alternatives is acceptable to the client the methods return None.

        Parameters:
        alternatives - (undocumented)
        Returns:
        (undocumented)