Package io.servicetalk.http.api
Class ContentCodingHttpServiceFilter
- java.lang.Object
-
- io.servicetalk.http.api.ContentCodingHttpServiceFilter
-
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpServiceFilterFactory
public final class ContentCodingHttpServiceFilter extends java.lang.Object implements StreamingHttpServiceFilterFactory, HttpExecutionStrategyInfluencer
AStreamingHttpServicethat adds encoding / decoding functionality for responses and requests respectively, as these are specified by the spec Content-Encoding.Append this filter before others that are expected to to see compressed content for this request/response, and after other filters that expect to see/manipulate the original payload.
-
-
Constructor Summary
Constructors Constructor Description ContentCodingHttpServiceFilter(java.util.List<ContentCodec> supportedCodings)Enable support of the provided encodings for this server's responses.ContentCodingHttpServiceFilter(java.util.List<ContentCodec> supportedRequestCodings, java.util.List<ContentCodec> supportedResponseCodings)Enable support of the provided encodings for both client requests and server responses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamingHttpServiceFiltercreate(StreamingHttpService service)Create aStreamingHttpServiceFilterusing the providedStreamingHttpService.HttpExecutionStrategyinfluenceStrategy(HttpExecutionStrategy strategy)Optionally modify the passedHttpExecutionStrategyto a newHttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.servicetalk.http.api.StreamingHttpServiceFilterFactory
append
-
-
-
-
Constructor Detail
-
ContentCodingHttpServiceFilter
public ContentCodingHttpServiceFilter(java.util.List<ContentCodec> supportedCodings)
Enable support of the provided encodings for this server's responses. The encodings will be used for server responses compression where enabled and matched with client ones.Client requests that have compressed payloads will be rejected. To enable support of compressed requests, see
ContentCodingHttpServiceFilter(List, List).- Parameters:
supportedCodings- the codecs used to compress responses when allowed.
-
ContentCodingHttpServiceFilter
public ContentCodingHttpServiceFilter(java.util.List<ContentCodec> supportedRequestCodings, java.util.List<ContentCodec> supportedResponseCodings)
Enable support of the provided encodings for both client requests and server responses. The encodings can differ for requests and responses, allowing a server that supports different compressions for requests and different ones for responses.To disable support of compressed requests use an
Collections.emptyList()for thesupportedRequestCodingsparam or useContentCodingHttpServiceFilter(List)constructor instead.The order of the codecs provided, affect selection priority alongside the order of the incoming accept-encoding header from the client.
- Parameters:
supportedRequestCodings- the codecs used to decompress client requests if compressed.supportedResponseCodings- the codecs used to compress server responses if client accepts them.
-
-
Method Detail
-
create
public StreamingHttpServiceFilter create(StreamingHttpService service)
Description copied from interface:StreamingHttpServiceFilterFactoryCreate aStreamingHttpServiceFilterusing the providedStreamingHttpService.- Specified by:
createin interfaceStreamingHttpServiceFilterFactory- Parameters:
service-StreamingHttpServiceto filter- Returns:
StreamingHttpServiceFilterusing the providedStreamingHttpService.
-
influenceStrategy
public HttpExecutionStrategy influenceStrategy(HttpExecutionStrategy strategy)
Description copied from interface:HttpExecutionStrategyInfluencerOptionally modify the passedHttpExecutionStrategyto a newHttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer.- Specified by:
influenceStrategyin interfaceHttpExecutionStrategyInfluencer- Parameters:
strategy-HttpExecutionStrategyto influence.- Returns:
HttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer
-
-