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 ofStreamingHttpService
that 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 Completable
closeAsync()
Closes thisStreamingHttpService
asynchronously.Completable
closeAsyncGracefully()
Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing.protected StreamingHttpService
delegate()
ReturnsStreamingHttpService
to 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
-StreamingHttpService
to delegate all calls.
-
-
Method Detail
-
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.
-
closeAsync
public Completable 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
public Completable 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
protected final StreamingHttpService delegate()
ReturnsStreamingHttpService
to which all calls are delegated.- Returns:
StreamingHttpService
to which all calls are delegated.
-
-