public class StreamingHttpServiceFilter extends java.lang.Object implements StreamingHttpService
StreamingHttpService
that delegates all methods to the provided
StreamingHttpService
.Constructor and Description |
---|
StreamingHttpServiceFilter(StreamingHttpService delegate)
New instance.
|
Modifier and Type | Method and Description |
---|---|
Completable |
closeAsync()
Closes this
StreamingHttpService asynchronously. |
Completable |
closeAsyncGracefully()
Used to close/shutdown a resource, similar to
AsyncCloseable.closeAsync() , but attempts to cleanup state before
abruptly closing. |
protected StreamingHttpService |
delegate()
Returns
StreamingHttpService to which all calls are delegated. |
Single<StreamingHttpResponse> |
handle(HttpServiceContext ctx,
StreamingHttpRequest request,
StreamingHttpResponseFactory responseFactory)
Handles a single HTTP request.
|
public StreamingHttpServiceFilter(StreamingHttpService delegate)
delegate
- StreamingHttpService
to delegate all calls.public Single<StreamingHttpResponse> handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory)
StreamingHttpService
handle
in interface StreamingHttpService
ctx
- Context of the service.request
- to handle.responseFactory
- used to create StreamingHttpResponse
objects.Single
of HTTP response.public Completable closeAsync()
StreamingHttpService
StreamingHttpService
asynchronously.closeAsync
in interface AsyncCloseable
closeAsync
in interface StreamingHttpService
Completable
that when subscribed will close this StreamingHttpService
.public Completable closeAsyncGracefully()
AsyncCloseable
AsyncCloseable.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 to AsyncCloseable.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()
.
closeAsyncGracefully
in interface AsyncCloseable
Completable
that is notified once the close is complete.protected final StreamingHttpService delegate()
StreamingHttpService
to which all calls are delegated.StreamingHttpService
to which all calls are delegated.