Interface BlockingHttpClient
- All Superinterfaces:
AutoCloseable,Closeable,LifeCycle<BlockingHttpClient>
- All Known Implementing Classes:
JdkBlockingHttpClient
HttpClient and
is designed primarily for testing purposes.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Method Summary
Modifier and TypeMethodDescriptiondefault <I,O> HttpResponse<O> exchange(HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisher.default <I,O> HttpResponse<O> exchange(HttpRequest<I> request, Argument<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.<I,O, E> HttpResponse<O> exchange(HttpRequest<I> request, Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <I,O> HttpResponse<O> exchange(HttpRequest<I> request, Class<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <O> HttpResponse<O>Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default <O> HttpResponse<O>Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default <O,E> HttpResponse<O> Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default BlockingHttpClientrefresh()Refreshes theBlockingHttpClientby stopping the current instance and starting a new one.default <I> Stringretrieve(HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <I,O> O retrieve(HttpRequest<I> request, Argument<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <I,O, E> O retrieve(HttpRequest<I> request, Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <I,O> O retrieve(HttpRequest<I> request, Class<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default StringPerform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <O> OPerform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.default <O,E> O Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.
-
Method Details
-
exchange
<I,O, HttpResponse<O> exchangeE> (HttpRequest<I> request, Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request for the given request object emitting the full HTTP response from returned
Publisherand converting the response body to the specified type.This method will send a
Content-Lengthheader and except a content length header the response and is designed for simple non-streaming exchanges of dataBy default the exchange
Content-Typeis application/json, unless otherwise specified in the passedHttpRequest- Type Parameters:
I- The request body typeO- The response body typeE- The error type- Parameters:
request- TheHttpRequestto executebodyType- The body typeerrorType- The error type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform an HTTP request for the given request object emitting the full HTTP response from returned
Publisherand converting the response body to the specified type.This method will send a
Content-Lengthheader and except a content length header the response and is designed for simple non-streaming exchanges of dataBy default the exchange
Content-Typeis application/json, unless otherwise specified in the passedHttpRequest- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisher.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto execute- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A result of the given type or null the URI returns a 404
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body typeE- The error type- Parameters:
request- TheHttpRequestto executebodyType- The body typeerrorType- The error type- Returns:
- A result of the given type or null the URI returns a 404
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A result of the given type or null the URI returns a 404
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
I- The request body type- Parameters:
request- TheHttpRequestto execute- Returns:
- A string result or null if a 404 is returned
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Parameters:
uri- The URI- Returns:
- A string result or null if a 404 is returned
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisherand converting the response body to the specified type.- Type Parameters:
O- The body generic type- Parameters:
uri- The URIbodyType- The body type- Returns:
- A result or null if a 404 is returned
- Throws:
HttpClientResponseException- when an error status is returned
-
retrieve
Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.- Type Parameters:
O- The response body typeE- The error type- Parameters:
uri- The URI of the GET requestbodyType- The body typeerrorType- The error type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.- Type Parameters:
O- The response body type- Parameters:
uri- The URI of the GET request- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.- Type Parameters:
O- The response body type- Parameters:
uri- The URI of the GET requestbodyType- The body type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
exchange
Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.- Type Parameters:
O- The response body typeE- The error type- Parameters:
uri- The URI of the GET requestbodyType- The body typeerrorType- The error type- Returns:
- The full
HttpResponseobject - Throws:
HttpClientResponseException- when an error status is returned
-
refresh
Refreshes theBlockingHttpClientby stopping the current instance and starting a new one.- Specified by:
refreshin interfaceLifeCycle<BlockingHttpClient>- Returns:
- refreshed instance of
BlockingHttpClient
-