public final class EncodingNegotiator
extends java.lang.Object
Constructor and Description |
---|
EncodingNegotiator(scala.collection.immutable.Seq<HttpHeader> requestHeaders) |
Modifier and Type | Method and 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.
|
public EncodingNegotiator(scala.collection.immutable.Seq<HttpHeader> requestHeaders)
public static EncodingNegotiator apply(scala.collection.immutable.Seq<HttpHeader> requestHeaders)
public scala.collection.immutable.List<HttpEncodingRange> acceptedEncodingRanges()
Accept-Encoding
header(s)public float qValueFor(HttpEncoding encoding)
encoding
- (undocumented)public boolean isAccepted(HttpEncoding encoding)
encoding
- (undocumented)public boolean hasMatchingFor(HttpEncoding encoding)
Accept-Encoding
clause matching the given encoding.encoding
- (undocumented)public scala.Option<HttpEncoding> pickEncoding(scala.collection.immutable.List<HttpEncoding> alternatives)
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
.
alternatives
- (undocumented)