Package io.servicetalk.http.api
Class StreamingHttpServiceFilter
java.lang.Object
io.servicetalk.http.api.StreamingHttpServiceFilter
- All Implemented Interfaces:
AsyncCloseable
,HttpExecutionStrategyInfluencer
,HttpServiceBase
,StreamingHttpService
,ExecutionStrategyInfluencer<HttpExecutionStrategy>
An implementation of
StreamingHttpService
that delegates all methods to the provided
StreamingHttpService
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCloses thisStreamingHttpService
asynchronously.Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing.protected final StreamingHttpService
delegate()
ReturnsStreamingHttpService
to which all calls are delegated.handle
(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory) Handles a single HTTP request.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
-
StreamingHttpServiceFilter
New instance.- Parameters:
delegate
-StreamingHttpService
to delegate all calls.
-
-
Method Details
-
handle
public Single<StreamingHttpResponse> handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory) Description copied from interface:StreamingHttpService
Handles a single HTTP request.- Specified by:
handle
in interfaceStreamingHttpService
- Parameters:
ctx
- Context of the service.request
- to handle.responseFactory
- used to createStreamingHttpResponse
objects.- Returns:
Single
of HTTP response.
-
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
- Specified by:
requiredOffloads
in interfaceStreamingHttpService
- Returns:
- the
ExecutionStrategy
required by the influencer.
-
closeAsync
Description copied from interface:StreamingHttpService
Closes thisStreamingHttpService
asynchronously.- Specified by:
closeAsync
in interfaceAsyncCloseable
- Specified by:
closeAsync
in interfaceStreamingHttpService
- Returns:
Completable
that when subscribed will close thisStreamingHttpService
.
-
closeAsyncGracefully
Description copied from interface:AsyncCloseable
Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in flight work. This method is implemented on a "best effort" basis and may be equivalent toAsyncCloseable.closeAsync()
.Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a timeout and force a call to
AsyncCloseable.closeAsync()
.- Specified by:
closeAsyncGracefully
in interfaceAsyncCloseable
- Returns:
- A
Completable
that is notified once the close is complete.
-
delegate
ReturnsStreamingHttpService
to which all calls are delegated.- Returns:
StreamingHttpService
to which all calls are delegated.
-