Package io.servicetalk.http.api
Interface HttpRequester
- All Superinterfaces:
AsyncCloseable
,AutoCloseable
,GracefulAutoCloseable
,HttpRequestFactory
,ListenableAsyncCloseable
- All Known Subinterfaces:
HttpClient
,HttpConnection
,ReservedHttpConnection
public interface HttpRequester
extends HttpRequestFactory, ListenableAsyncCloseable, GracefulAutoCloseable
Provides a means to make a HTTP request.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
default void
Used to close/shutdown a resource, similar toAutoCloseable.close()
, but attempts to cleanup state before abruptly closing.Get theHttpExecutionContext
used during construction of this object.Get aHttpResponseFactory
.request
(HttpRequest request) Send arequest
.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.http.api.HttpRequestFactory
connect, delete, get, head, newRequest, options, patch, post, put, trace
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
request
Send arequest
.- Parameters:
request
- the request to send.- Returns:
- The response.
-
executionContext
HttpExecutionContext executionContext()Get theHttpExecutionContext
used during construction of this object.Note that the
ExecutionContext.ioExecutor()
will not necessarily be associated with a specific thread unless that was how this object was built.- Returns:
- the
HttpExecutionContext
used during construction of this object.
-
httpResponseFactory
HttpResponseFactory httpResponseFactory()Get aHttpResponseFactory
.- Returns:
- a
HttpResponseFactory
.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
closeGracefully
Description copied from interface:GracefulAutoCloseable
Used to close/shutdown a resource, similar toAutoCloseable.close()
, 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 toAutoCloseable.close()
.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
AutoCloseable.close()
.- Specified by:
closeGracefully
in interfaceGracefulAutoCloseable
- Throws:
Exception
- if graceful closure failed.
-