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
AStreamingHttpService
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
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 StreamingHttpServiceFilter
create(StreamingHttpService service)
Create aStreamingHttpServiceFilter
using the providedStreamingHttpService
.HttpExecutionStrategy
influenceStrategy(HttpExecutionStrategy strategy)
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that 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 thesupportedRequestCodings
param 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:StreamingHttpServiceFilterFactory
Create aStreamingHttpServiceFilter
using the providedStreamingHttpService
.- Specified by:
create
in interfaceStreamingHttpServiceFilterFactory
- Parameters:
service
-StreamingHttpService
to filter- Returns:
StreamingHttpServiceFilter
using the providedStreamingHttpService
.
-
influenceStrategy
public HttpExecutionStrategy influenceStrategy(HttpExecutionStrategy strategy)
Description copied from interface:HttpExecutionStrategyInfluencer
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
.- Specified by:
influenceStrategy
in interfaceHttpExecutionStrategyInfluencer
- Parameters:
strategy
-HttpExecutionStrategy
to influence.- Returns:
HttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
-
-