Package akka.http.scaladsl.server
Class EncodingNegotiator
java.lang.Object
akka.http.scaladsl.server.EncodingNegotiator
-
Constructor Summary
ConstructorDescriptionEncodingNegotiator
(scala.collection.immutable.Seq<HttpHeader> requestHeaders) -
Method Summary
Modifier and TypeMethodDescriptionscala.collection.immutable.List<HttpEncodingRange>
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 theAccept-Encoding
header(s)static EncodingNegotiator
apply
(scala.collection.immutable.Seq<HttpHeader> requestHeaders) boolean
hasMatchingFor
(HttpEncoding encoding) Determines whether the request has anAccept-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'sAccept-Encoding
headers.float
qValueFor
(HttpEncoding encoding) Returns the q-value that the client (implicitly or explicitly) attaches to the given encoding.
-
Constructor Details
-
EncodingNegotiator
-
-
Method Details
-
apply
-
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 theAccept-Encoding
header(s)- Returns:
- (undocumented)
-
qValueFor
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
Determines whether the given encoding is accepted by the client.- Parameters:
encoding
- (undocumented)- Returns:
- (undocumented)
-
hasMatchingFor
Determines whether the request has anAccept-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'sAccept-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)
-