Package io.servicetalk.http.api
Interface BlockingHttpClient
- All Superinterfaces:
AutoCloseable,BlockingHttpRequester,GracefulAutoCloseable,HttpRequestFactory
The equivalent of
HttpClient but with synchronous/blocking APIs instead of asynchronous APIs.-
Method Summary
Modifier and TypeMethodDescriptiondefault BlockingStreamingHttpClientConvert thisBlockingHttpClientto theBlockingStreamingHttpClientAPI.default HttpClientasClient()Convert thisBlockingHttpClientto theHttpClientAPI.Convert thisBlockingHttpClientto theStreamingHttpClientAPI.reserveConnection(HttpRequestMetaData metaData) Reserve aBlockingHttpConnectionbased on providedHttpRequestMetaData.Methods inherited from interface io.servicetalk.http.api.BlockingHttpRequester
close, executionContext, httpResponseFactory, requestMethods inherited from interface io.servicetalk.concurrent.GracefulAutoCloseable
closeGracefully
-
Method Details
-
reserveConnection
Reserve aBlockingHttpConnectionbased 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 whatBlockingHttpConnections are valid to reserve for futurerequestswith the sameHttpRequestMetaData. For example this may provide some insight into shard or other info.- Returns:
- a
ReservedBlockingHttpConnection. - Throws:
Exception- if a exception occurs during the reservation process.- See Also:
-
asStreamingClient
StreamingHttpClient asStreamingClient()Convert thisBlockingHttpClientto theStreamingHttpClientAPI.- Returns:
- a
StreamingHttpClientrepresentation of thisBlockingHttpClient.
-
asClient
Convert thisBlockingHttpClientto theHttpClientAPI.- Returns:
- a
HttpClientrepresentation of thisBlockingHttpClient.
-
asBlockingStreamingClient
Convert thisBlockingHttpClientto theBlockingStreamingHttpClientAPI.- Returns:
- a
BlockingStreamingHttpClientrepresentation of thisBlockingHttpClient.
-