Package io.servicetalk.http.api
Class ContentEncodingHttpServiceFilter
java.lang.Object
io.servicetalk.http.api.ContentEncodingHttpServiceFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer
,StreamingHttpServiceFilterFactory
,ExecutionStrategyInfluencer<HttpExecutionStrategy>
public final class ContentEncodingHttpServiceFilter
extends Object
implements StreamingHttpServiceFilterFactory
A
StreamingHttpService
that 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
ConstructorDescriptionContentEncodingHttpServiceFilter
(List<BufferEncoder> compressors) Create a new instance and specify the supported compression (matched againstHttpHeaderNames.ACCEPT_ENCODING
).ContentEncodingHttpServiceFilter
(List<BufferEncoder> compressors, BufferDecoderGroup decompressors) Create a new instance and specify the supported decompression (matched againstHttpHeaderNames.CONTENT_ENCODING
) and compression (matched againstHttpHeaderNames.ACCEPT_ENCODING
). -
Method Summary
Modifier and TypeMethodDescriptioncreate
(StreamingHttpService service) Create aStreamingHttpServiceFilter
using the providedStreamingHttpService
.Return anExecutionStrategy
that describes the offloads required by the influencer.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.HttpExecutionStrategyInfluencer
influenceStrategy
-
Constructor Details
-
ContentEncodingHttpServiceFilter
Create a new instance and specify the supported compression (matched againstHttpHeaderNames.ACCEPT_ENCODING
). The order of entries may impact the selection preference.- Parameters:
compressors
- used to compress server responses if client accepts them.
-
ContentEncodingHttpServiceFilter
public ContentEncodingHttpServiceFilter(List<BufferEncoder> compressors, BufferDecoderGroup decompressors) Create a new instance and specify the supported decompression (matched againstHttpHeaderNames.CONTENT_ENCODING
) and compression (matched againstHttpHeaderNames.ACCEPT_ENCODING
). The order of entries may impact the selection preference.- Parameters:
compressors
- used to compress server responses if client accepts them.decompressors
- used to decompress client requests if compressed.
-
-
Method Details
-
create
Description copied from interface:StreamingHttpServiceFilterFactory
Create aStreamingHttpServiceFilter
using the providedStreamingHttpService
.- Specified by:
create
in interfaceStreamingHttpServiceFilterFactory
- Parameters:
service
-StreamingHttpService
to filter- Returns:
StreamingHttpServiceFilter
using the providedStreamingHttpService
.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencer
Return anExecutionStrategy
that describes the offloads required by the influencer.The provided default implementation requests offloading of all operations. Implementations that require no offloading should be careful to return
HttpExecutionStrategies.offloadNone()
rather thanHttpExecutionStrategies.offloadNever()
. Implementations should avoid returningHttpExecutionStrategies.defaultStrategy()
, instead returning the strategy they require orHttpExecutionStrategies.offloadAll()
if offloading for all paths is required (safe default).- Specified by:
requiredOffloads
in interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>
- Specified by:
requiredOffloads
in interfaceHttpExecutionStrategyInfluencer
- Returns:
- the
ExecutionStrategy
required by the influencer.
-