Class HttpRequestAutoDrainingServiceFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer
,StreamingHttpServiceFilterFactory
,ExecutionStrategyInfluencer<HttpExecutionStrategy>
payload body
when it is not
consumed by the service.
For persistent HTTP connections it is required to
eventually consume the entire request payload to enable reading of the next request. This is required because
requests are pipelined for HTTP/1.1, so if the previous request is not completely read, next request can not be
read from the socket. For cases when there is a possibility that user may forget to consume request payload,
this filter can be used to automatically consume request payload body on the server-side.
An example of guaranteed consumption are non-streaming APIs
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StreamingHttpServiceFilterFactory
Singleton instance of the draining service filter. -
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
-
Field Details
-
INSTANCE
Singleton instance of the draining service filter.
-
-
Method Details
-
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.
-
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
.
-