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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCloses thisStreamingHttpServiceasynchronously.Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing.protected final StreamingHttpServicedelegate()ReturnsStreamingHttpServiceto which all calls are delegated.handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory) Handles a single HTTP request.Return anExecutionStrategythat describes the offloads required by the influencer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy
-
Constructor Details
-
StreamingHttpServiceFilter
New instance.- Parameters:
delegate-StreamingHttpServiceto delegate all calls.
-
-
Method Details
-
handle
public Single<StreamingHttpResponse> handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory) Description copied from interface:StreamingHttpServiceHandles a single HTTP request.- Specified by:
handlein interfaceStreamingHttpService- Parameters:
ctx- Context of the service.request- to handle.responseFactory- used to createStreamingHttpResponseobjects.- Returns:
Singleof HTTP response.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencerReturn anExecutionStrategythat 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:
requiredOffloadsin interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>- Specified by:
requiredOffloadsin interfaceHttpExecutionStrategyInfluencer- Specified by:
requiredOffloadsin interfaceStreamingHttpService- Returns:
- the
ExecutionStrategyrequired by the influencer.
-
closeAsync
Description copied from interface:StreamingHttpServiceCloses thisStreamingHttpServiceasynchronously.- Specified by:
closeAsyncin interfaceAsyncCloseable- Specified by:
closeAsyncin interfaceStreamingHttpService- Returns:
Completablethat when subscribed will close thisStreamingHttpService.
-
closeAsyncGracefully
Description copied from interface:AsyncCloseableUsed 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:
closeAsyncGracefullyin interfaceAsyncCloseable- Returns:
- A
Completablethat is notified once the close is complete.
-
delegate
ReturnsStreamingHttpServiceto which all calls are delegated.- Returns:
StreamingHttpServiceto which all calls are delegated.
-