Interface CodingDirectives
- All Known Subinterfaces:
Directives
- All Known Implementing Classes:
CodingDirectives$,Directives$,HttpApp
public interface CodingDirectives
-
Method Summary
Modifier and TypeMethodDescriptionDirective<scala.runtime.BoxedUnit>Decompresses the incoming request if it isgzipordeflatecompressed.Directive<scala.runtime.BoxedUnit>decodeRequestWith(Decoder decoder) Decodes the incoming request using the given Decoder.Directive<scala.runtime.BoxedUnit>decodeRequestWith(scala.collection.immutable.Seq<Decoder> decoders) Decodes the incoming request if it is encoded with one of the given encoders.Directive<scala.runtime.BoxedUnit>Encodes the response with the encoding that is requested by the client via theAccept- Encodingheader.Directive<scala.runtime.BoxedUnit>encodeResponseWith(Encoder first, scala.collection.immutable.Seq<Encoder> more) Encodes the response with the encoding that is requested by the client via theAccept- Encodingheader.Directive<scala.runtime.BoxedUnit>requestEncodedWith(HttpEncoding encoding) Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.Directive<scala.runtime.BoxedUnit>responseEncodingAccepted(HttpEncoding encoding) Rejects the request with an UnacceptedResponseEncodingRejection if the given response encoding is not accepted by the client.Directive<scala.runtime.BoxedUnit>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.
-
Method Details
-
responseEncodingAccepted
Rejects the request with an UnacceptedResponseEncodingRejection if the given response encoding is not accepted by the client.- Parameters:
encoding- (undocumented)- Returns:
- (undocumented)
-
encodeResponse
Directive<scala.runtime.BoxedUnit> encodeResponse()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.- Returns:
- (undocumented)
-
encodeResponseWith
Directive<scala.runtime.BoxedUnit> encodeResponseWith(Encoder first, scala.collection.immutable.Seq<Encoder> more) 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.- Parameters:
first- (undocumented)more- (undocumented)- Returns:
- (undocumented)
-
decodeRequestWith
Decodes the incoming request using the given Decoder. If the request encoding doesn't match the request is rejected with anUnsupportedRequestEncodingRejection.- Parameters:
decoder- (undocumented)- Returns:
- (undocumented)
-
requestEncodedWith
Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.- Parameters:
encoding- (undocumented)- Returns:
- (undocumented)
-
decodeRequestWith
Directive<scala.runtime.BoxedUnit> decodeRequestWith(scala.collection.immutable.Seq<Decoder> decoders) 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:
decoders- (undocumented)- Returns:
- (undocumented)
-
decodeRequest
Directive<scala.runtime.BoxedUnit> decodeRequest()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.- Returns:
- (undocumented)
-
withPrecompressedMediaTypeSupport
Directive<scala.runtime.BoxedUnit> withPrecompressedMediaTypeSupport()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.- Returns:
- (undocumented)
-