Package io.servicetalk.http.api
Class StreamingHttpServiceFilter
- java.lang.Object
-
- io.servicetalk.http.api.StreamingHttpServiceFilter
-
- All Implemented Interfaces:
AsyncCloseable,StreamingHttpService
public class StreamingHttpServiceFilter extends java.lang.Object implements StreamingHttpService
An implementation ofStreamingHttpServicethat delegates all methods to the providedStreamingHttpService.
-
-
Constructor Summary
Constructors Constructor Description StreamingHttpServiceFilter(StreamingHttpService delegate)New instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletablecloseAsync()Closes thisStreamingHttpServiceasynchronously.CompletablecloseAsyncGracefully()Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing.protected StreamingHttpServicedelegate()ReturnsStreamingHttpServiceto which all calls are delegated.Single<StreamingHttpResponse>handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory)Handles a single HTTP request.
-
-
-
Constructor Detail
-
StreamingHttpServiceFilter
public StreamingHttpServiceFilter(StreamingHttpService delegate)
New instance.- Parameters:
delegate-StreamingHttpServiceto delegate all calls.
-
-
Method Detail
-
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.
-
closeAsync
public Completable closeAsync()
Description copied from interface:StreamingHttpServiceCloses thisStreamingHttpServiceasynchronously.- Specified by:
closeAsyncin interfaceAsyncCloseable- Specified by:
closeAsyncin interfaceStreamingHttpService- Returns:
Completablethat when subscribed will close thisStreamingHttpService.
-
closeAsyncGracefully
public Completable 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
protected final StreamingHttpService delegate()
ReturnsStreamingHttpServiceto which all calls are delegated.- Returns:
StreamingHttpServiceto which all calls are delegated.
-
-