Package io.servicetalk.http.api
Interface HttpClient
- All Superinterfaces:
AsyncCloseable,AutoCloseable,GracefulAutoCloseable,HttpRequester,HttpRequestFactory,ListenableAsyncCloseable
Provides a means to issue requests against HTTP service. The implementation is free to maintain a collection of
HttpConnection instances and distribute calls to HttpRequester.request(HttpRequest) amongst this collection.-
Method Summary
Modifier and TypeMethodDescriptiondefault BlockingHttpClientConvert thisHttpClientto theBlockingHttpClientAPI.default BlockingStreamingHttpClientConvert thisHttpClientto theBlockingStreamingHttpClientAPI.Convert thisHttpClientto theStreamingHttpClientAPI.reserveConnection(HttpRequestMetaData metaData) Reserve anHttpConnectionbased on providedHttpRequestMetaData.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.http.api.HttpRequester
close, closeGracefully, executionContext, httpResponseFactory, requestMethods inherited from interface io.servicetalk.http.api.HttpRequestFactory
connect, delete, get, head, newRequest, options, patch, post, put, traceMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
reserveConnection
Reserve anHttpConnectionbased on providedHttpRequestMetaData.If a new connection should be opened instead of potentially reusing an already established one, the
HttpContextKeys.HTTP_FORCE_NEW_CONNECTIONmust be set.- Parameters:
metaData- Allows the underlying layers to know whatHttpConnections are valid to reserve for futurerequestswith the sameHttpRequestMetaData. For example this may provide some insight into shard or other info.- Returns:
- a
Singlethat provides theReservedHttpConnectionupon completion. - See Also:
-
asStreamingClient
StreamingHttpClient asStreamingClient()Convert thisHttpClientto theStreamingHttpClientAPI.- Returns:
- a
StreamingHttpClientrepresentation of thisHttpClient.
-
asBlockingStreamingClient
Convert thisHttpClientto theBlockingStreamingHttpClientAPI.- Returns:
- a
BlockingStreamingHttpClientrepresentation of thisHttpClient.
-
asBlockingClient
Convert thisHttpClientto theBlockingHttpClientAPI.- Returns:
- a
BlockingHttpClientrepresentation of thisHttpClient.
-