Interface BlockingHttpClient
- All Superinterfaces:
AutoCloseable,Closeable
HttpClient and
is designed primarily for testing purposes.- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault <I,O> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisher.default <I,O> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.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> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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> io.micronaut.http.HttpResponse<O> 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> io.micronaut.http.HttpResponse<O>Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default <O> io.micronaut.http.HttpResponse<O>Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default <O,E> io.micronaut.http.HttpResponse<O> Perform a GET request for the given request object emitting the full HTTP response from returnedPublisher.default <I> Stringretrieve(io.micronaut.http.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(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.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(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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 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, io.micronaut.http.HttpResponse<O> exchangeE> (io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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
default <I,O> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType) 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
default <I,O> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.HttpRequest<I> request) 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
default <I,O> io.micronaut.http.HttpResponse<O> exchange(io.micronaut.http.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.- 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
default <I,O> O retrieve(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.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.- 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
default <I,O, O retrieveE> (io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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.- 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
default <O,E> io.micronaut.http.HttpResponse<O> exchange(String uri, Class<O> bodyType, Class<E> errorType) 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
-