Class CodingDirectives
- java.lang.Object
-
- akka.http.javadsl.server.directives.BasicDirectives
-
- akka.http.javadsl.server.directives.CacheConditionDirectives
-
- akka.http.javadsl.server.directives.CodingDirectives
-
- Direct Known Subclasses:
CookieDirectives
public abstract class CodingDirectives extends CacheConditionDirectives
-
-
Constructor Summary
Constructors Constructor Description CodingDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoutedecodeRequest(java.util.function.Supplier<Route> inner)Decompresses the incoming request if it isgzipordeflatecompressed.RoutedecodeRequestWith(Coder coder, java.util.function.Supplier<Route> inner)Decodes the incoming request using the given Decoder.RoutedecodeRequestWith(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.RouteencodeResponse(java.util.function.Supplier<Route> inner)Encodes the response with the encoding that is requested by the client via theAccept- Encodingheader.RouteencodeResponseWith(java.lang.Iterable<Coder> coders, java.util.function.Supplier<Route> inner)Encodes the response with the encoding that is requested by the client via theAccept- Encodingheader.RouterequestEncodedWith(HttpEncoding encoding, java.util.function.Supplier<Route> inner)Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.RouteresponseEncodingAccepted(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.RoutewithPrecompressedMediaTypeSupport(java.util.function.Supplier<Route> inner)Inspects the response entity and adds aContent-Encoding: gzipresponse header if the entity's media-type is precompressed with gzip and noContent-Encodingheader is present yet.-
Methods inherited from class akka.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditional
-
Methods inherited from class akka.http.javadsl.server.directives.BasicDirectives
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
-
-
-
-
Method Detail
-
decodeRequest
public Route decodeRequest(java.util.function.Supplier<Route> inner)
Decompresses the incoming request if it isgzipordeflatecompressed. Uncompressed requests are passed through untouched. If the request encoded with another encoding the request is rejected with anUnsupportedRequestEncodingRejection.- Parameters:
inner- (undocumented)- Returns:
- (undocumented)
-
decodeRequestWith
public Route decodeRequestWith(Coder coder, java.util.function.Supplier<Route> inner)
Decodes the incoming request using the given Decoder. If the request encoding doesn't match the request is rejected with anUnsupportedRequestEncodingRejection.- Parameters:
coder- (undocumented)inner- (undocumented)- Returns:
- (undocumented)
-
decodeRequestWith
public 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. If the request encoding doesn't match one of the given encoders the request is rejected with anUnsupportedRequestEncodingRejection. If no decoders are given the default encoders (Gzip,Deflate,NoCoding) are used.- Parameters:
coders- (undocumented)inner- (undocumented)- Returns:
- (undocumented)
-
encodeResponse
public Route encodeResponse(java.util.function.Supplier<Route> inner)
Encodes the response with the encoding that is requested by the client via theAccept- Encodingheader. The response encoding is determined by the rules specified in http://tools.ietf.org/html/rfc7231#section-5.3.4.If the
Accept-Encodingheader is missing or empty or specifies an encoding other than identity, gzip or deflate then no encoding is used.- Parameters:
inner- (undocumented)- Returns:
- (undocumented)
-
encodeResponseWith
public 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 theAccept- Encodingheader. The response encoding is determined by the rules specified in http://tools.ietf.org/html/rfc7231#section-5.3.4.If the
Accept-Encodingheader is missing then the response is encoded using thefirstencoder.If the
Accept-Encodingheader is empty andNoCodingis part of the encoders then no response encoding is used. Otherwise the request is rejected.If [encoders] is empty, no encoding is performed.
- Parameters:
coders- (undocumented)inner- (undocumented)- Returns:
- (undocumented)
-
requestEncodedWith
public 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.- Parameters:
encoding- (undocumented)inner- (undocumented)- Returns:
- (undocumented)
-
responseEncodingAccepted
public 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.- Parameters:
encoding- (undocumented)inner- (undocumented)- Returns:
- (undocumented)
-
withPrecompressedMediaTypeSupport
public Route withPrecompressedMediaTypeSupport(java.util.function.Supplier<Route> inner)
Inspects the response entity and adds aContent-Encoding: gzipresponse header if the entity's media-type is precompressed with gzip and noContent-Encodingheader is present yet.- Parameters:
inner- (undocumented)- Returns:
- (undocumented)
-
-