public abstract class CodingDirectives extends CacheConditionDirectives
Constructor and Description |
---|
CodingDirectives() |
Modifier and Type | Method and Description |
---|---|
Route |
decodeRequest(java.util.function.Supplier<Route> inner)
Decompresses the incoming request if it is
gzip or deflate compressed. |
Route |
decodeRequestWith(Coder coder,
java.util.function.Supplier<Route> inner)
Decodes the incoming request using the given Decoder.
|
Route |
decodeRequestWith(java.lang.Iterable<Coder> coders,
java.util.function.Supplier<Route> inner)
Decodes the incoming request if it is encoded with one of the given
encoders.
|
Route |
encodeResponse(java.util.function.Supplier<Route> inner)
Encodes the response with the encoding that is requested by the client via the
Accept-
Encoding header. |
Route |
encodeResponseWith(java.lang.Iterable<Coder> coders,
java.util.function.Supplier<Route> inner)
Encodes the response with the encoding that is requested by the client via the
Accept-
Encoding header. |
Route |
requestEncodedWith(HttpEncoding encoding,
java.util.function.Supplier<Route> inner)
Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.
|
Route |
responseEncodingAccepted(HttpEncoding encoding,
java.util.function.Supplier<Route> inner)
Rejects the request with an UnacceptedResponseEncodingRejection
if the given response encoding is not accepted by the client.
|
Route |
withPrecompressedMediaTypeSupport(java.util.function.Supplier<Route> inner)
Inspects the response entity and adds a
Content-Encoding: gzip response header if
the entity's media-type is precompressed with gzip and no Content-Encoding header is present yet. |
conditional, conditional, conditional, conditional
cancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
public Route decodeRequest(java.util.function.Supplier<Route> inner)
gzip
or deflate
compressed.
Uncompressed requests are passed through untouched.
If the request encoded with another encoding the request is rejected with an UnsupportedRequestEncodingRejection
.inner
- (undocumented)public Route decodeRequestWith(Coder coder, java.util.function.Supplier<Route> inner)
UnsupportedRequestEncodingRejection
.coder
- (undocumented)inner
- (undocumented)public Route decodeRequestWith(java.lang.Iterable<Coder> coders, java.util.function.Supplier<Route> inner)
UnsupportedRequestEncodingRejection
.
If no decoders are given the default encoders (Gzip
, Deflate
, NoCoding
) are used.coders
- (undocumented)inner
- (undocumented)public Route encodeResponse(java.util.function.Supplier<Route> inner)
Accept-
Encoding
header. The response encoding is determined by the rules specified in
http://tools.ietf.org/html/rfc7231#section-5.3.4.
If the Accept-Encoding
header is missing or empty or specifies an encoding other than
identity, gzip or deflate then no encoding is used.
inner
- (undocumented)public Route encodeResponseWith(java.lang.Iterable<Coder> coders, java.util.function.Supplier<Route> inner)
Accept-
Encoding
header. The response encoding is determined by the rules specified in
http://tools.ietf.org/html/rfc7231#section-5.3.4.
If the Accept-Encoding
header is missing then the response is encoded using the first
encoder.
If the Accept-Encoding
header is empty and NoCoding
is part of the encoders then no
response encoding is used. Otherwise the request is rejected.
If [encoders] is empty, no encoding is performed.
coders
- (undocumented)inner
- (undocumented)public Route requestEncodedWith(HttpEncoding encoding, java.util.function.Supplier<Route> inner)
encoding
- (undocumented)inner
- (undocumented)public Route responseEncodingAccepted(HttpEncoding encoding, java.util.function.Supplier<Route> inner)
encoding
- (undocumented)inner
- (undocumented)public Route withPrecompressedMediaTypeSupport(java.util.function.Supplier<Route> inner)
Content-Encoding: gzip
response header if
the entity's media-type is precompressed with gzip and no Content-Encoding
header is present yet.inner
- (undocumented)