Interface BlockingHttpClient
- All Superinterfaces:
AutoCloseable
,Closeable
- 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 returnedPublisher
and 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 returnedPublisher
and 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 returnedPublisher
and 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 <I> String
retrieve
(HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisher
and 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 returnedPublisher
and 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 returnedPublisher
and 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 returnedPublisher
and converting the response body to the specified type.default String
Perform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisher
and converting the response body to the specified type.default <O> O
Perform an HTTP GET request for the given request object emitting the full HTTP response from returnedPublisher
and 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
Publisher
and converting the response body to the specified type.This method will send a
Content-Length
header and except a content length header the response and is designed for simple non-streaming exchanges of dataBy default the exchange
Content-Type
is application/json, unless otherwise specified in the passedHttpRequest
- Type Parameters:
I
- The request body typeO
- The response body typeE
- The error type- Parameters:
request
- TheHttpRequest
to executebodyType
- The body typeerrorType
- The error type- Returns:
- The full
HttpResponse
object - 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
Publisher
and converting the response body to the specified type.This method will send a
Content-Length
header and except a content length header the response and is designed for simple non-streaming exchanges of dataBy default the exchange
Content-Type
is application/json, unless otherwise specified in the passedHttpRequest
- Type Parameters:
I
- The request body typeO
- The response body type- Parameters:
request
- TheHttpRequest
to executebodyType
- The body type- Returns:
- The full
HttpResponse
object - 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
- TheHttpRequest
to execute- Returns:
- The full
HttpResponse
object - 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
and converting the response body to the specified type.- Type Parameters:
I
- The request body typeO
- The response body type- Parameters:
request
- TheHttpRequest
to executebodyType
- The body type- Returns:
- The full
HttpResponse
object - Throws:
HttpClientResponseException
- when an error status is returned
-
retrieve
Perform an HTTP request for the given request object emitting the full HTTP response from returnedPublisher
and converting the response body to the specified type.- Type Parameters:
I
- The request body typeO
- The response body type- Parameters:
request
- TheHttpRequest
to 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 returnedPublisher
and converting the response body to the specified type.- Type Parameters:
I
- The request body typeO
- The response body typeE
- The error type- Parameters:
request
- TheHttpRequest
to 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 returnedPublisher
and converting the response body to the specified type.- Type Parameters:
I
- The request body typeO
- The response body type- Parameters:
request
- TheHttpRequest
to 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 returnedPublisher
and converting the response body to the specified type.- Type Parameters:
I
- The request body type- Parameters:
request
- TheHttpRequest
to 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 returnedPublisher
and 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 returnedPublisher
and 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
HttpResponse
object - 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
HttpResponse
object - 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
HttpResponse
object - 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
HttpResponse
object - Throws:
HttpClientResponseException
- when an error status is returned
-