Class CharsetNegotiator


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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      scala.collection.immutable.List<HttpCharsetRange> acceptedCharsetRanges()
      The charset-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 HttpCharset) 3. order of appearance in the Accept-Charset header(s)
      boolean isAccepted​(HttpCharset charset)
      Determines whether the given charset is accepted by the client.
      scala.Option<HttpCharset> pickBest()
      Picks the charset that is most preferred by the client with a bias towards UTF-8, i.e. if the client accepts all charsets with equal preference then UTF-8 is picked.
      float qValueFor​(HttpCharset charset)
      Returns the q-value that the client (implicitly or explicitly) attaches to the given charset.
      • Methods inherited from class java.lang.Object

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

      • CharsetNegotiator

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

      • acceptedCharsetRanges

        public scala.collection.immutable.List<HttpCharsetRange> acceptedCharsetRanges()
        The charset-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 HttpCharset) 3. order of appearance in the Accept-Charset header(s)
        Returns:
        (undocumented)
      • isAccepted

        public boolean isAccepted​(HttpCharset charset)
        Determines whether the given charset is accepted by the client.
        Parameters:
        charset - (undocumented)
        Returns:
        (undocumented)
      • pickBest

        public scala.Option<HttpCharset> pickBest()
        Picks the charset that is most preferred by the client with a bias towards UTF-8, i.e. if the client accepts all charsets with equal preference then UTF-8 is picked. If the client doesn't accept any charsets the method returns None.

        See also: http://tools.ietf.org/html/rfc7231#section-5.3.3

        Returns:
        (undocumented)
      • qValueFor

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