-
Method Summary
Modifier and TypeMethodDescription<E> HttpCall
<HttpResponse<E>> A bean response to execute async or sync.<E> HttpCall
<HttpResponse<E>> Same asas(Class)
but takes a generic parameterized type.HttpCall
<HttpResponse<byte[]>> Process as response HttpResponse<byte[]>.Process discarding response body as HttpResponse<Void>.Process as response HttpResponse<InputStream>.asLines()
Process as response HttpResponse<Stream<String>>.<E> HttpCall
<HttpResponse<List<E>>> Same asas(Class)
but returnsHttpResponse<List<E>>
.<E> HttpCall
<HttpResponse<List<E>>> Same asas(Class)
but returnsHttpResponse<List<E>>
.<E> HttpCall
<HttpResponse<Stream<E>>> Same asas(Class)
but returnsHttpResponse<Stream<E>>
.<E> HttpCall
<HttpResponse<Stream<E>>> Same asas(Class)
but returnsHttpResponse<Stream<E>>
.asString()
Process as String response body HttpResponse<String>.asVoid()
Process the response with check for 200 range status code returning as HttpResponse<Void>.<E> HttpCall
<E> A bean response to execute async or sync.<E> HttpCall
<E> A bean response to execute async or sync.<E> HttpCall
<HttpResponse<E>> handler
(HttpResponse.BodyHandler<E> bodyHandler) Call using any givenHttpResponse.BodyHandler
.Process expecting a list of beans response body (typically from json content).Process expecting a list of beans response body (typically from json content).Process expecting a stream of beans response body (typically from json content).Process expecting a stream of beans response body (typically from json content).
-
Method Details
-
asVoid
HttpCall<HttpResponse<Void>> asVoid()Process the response with check for 200 range status code returning as HttpResponse<Void>.Unlike
asDiscarding()
this request will read any response content as bytes with the view that the response content can be an error message that could be read via for exampleHttpException.bean(Class)
.Will throw an HttpException if the status code is in the error range allowing the caller to access the error message body via for example
HttpException.bean(Class)
This is intended to be used for POST, PUT, DELETE requests where the caller is only interested in the response body when an error occurs (status code not in 200 range).
HttpCall<HttpResponse<Void>> call = client.request() .path("hello/world") .GET() .call().asVoid();
- Returns:
- The HttpCall to allow sync or async execution
-
asDiscarding
HttpCall<HttpResponse<Void>> asDiscarding()Process discarding response body as HttpResponse<Void>.Unlike
asVoid()
this will discard any response body including any error response body. We should instead useasVoid()
if we might get an error response body that we want to read via for exampleHttpException.bean(Class)
.HttpCall<HttpResponse<Void>> call = client.request() .path("hello/world") .GET() .call().asDiscarding();
- Returns:
- The HttpCall to allow sync or async execution
-
asString
HttpCall<HttpResponse<String>> asString()Process as String response body HttpResponse<String>.HttpCall<HttpResponse<String>> call = client.request() .path("hello/world") .GET() .call().asString();
- Returns:
- The HttpCall to allow sync or async execution
-
asByteArray
HttpCall<HttpResponse<byte[]>> asByteArray()Process as response HttpResponse<byte[]>.- Returns:
- The CompletableFuture of the response
-
asLines
HttpCall<HttpResponse<Stream<String>>> asLines()Process as response HttpResponse<Stream<String>>.- Returns:
- The CompletableFuture of the response
-
asInputStream
HttpCall<HttpResponse<InputStream>> asInputStream()Process as response HttpResponse<InputStream>.- Returns:
- The CompletableFuture of the response
-
handler
Call using any givenHttpResponse.BodyHandler
.HttpCall<E> call = client.request() .path("hello/lineStream") .GET() .call().handler(HttpResponse.BodyHandler<E> ...);
- Parameters:
bodyHandler
- The response body handler to use- Returns:
- The HttpCall to allow sync or async execution
-
as
A bean response to execute async or sync.If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains the HttpResponse. This is the cause in the CompletionException.
HttpCall<HttpResponse<HelloDto>> call = client.request() ... .POST() .call().as(HelloDto.class);
- Parameters:
type
- The bean type to convert the content to- Returns:
- The HttpCall to allow sync or async execution
-
as
Same asas(Class)
but takes a generic parameterized type. -
asList
Same asas(Class)
but returnsHttpResponse<List<E>>
. -
asList
Same asas(Class)
but returnsHttpResponse<List<E>>
. -
asStream
Same asas(Class)
but returnsHttpResponse<Stream<E>>
. -
asStream
Same asas(Class)
but returnsHttpResponse<Stream<E>>
. -
bean
A bean response to execute async or sync.If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains the HttpResponse. This is the cause in the CompletionException.
HttpCall<HelloDto> call = client.request() ... .POST() .call().bean(HelloDto.class);
- Parameters:
type
- The bean type to convert the content to- Returns:
- The HttpCall to allow sync or async execution
-
list
Process expecting a list of beans response body (typically from json content).If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains the HttpResponse. This is the cause in the CompletionException.
HttpCall<List<HelloDto>> call = client.request() ... .GET() .call().list(HelloDto.class);
- Parameters:
type
- The bean type to convert the content to- Returns:
- The HttpCall to execute sync or async
-
stream
Process expecting a stream of beans response body (typically from json content).If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains the HttpResponse. This is the cause in the CompletionException.
HttpCall<Stream<HelloDto>> call = client.request() ... .GET() .call().stream(HelloDto.class);
- Parameters:
type
- The bean type to convert the content to- Returns:
- The HttpCall to execute sync or async
-
bean
A bean response to execute async or sync.- Parameters:
type
- The parameterized type to convert the content to- Returns:
- The HttpCall to allow sync or async execution
-
list
Process expecting a list of beans response body (typically from json content).- Parameters:
type
- The parameterized type to convert the content to- Returns:
- The HttpCall to execute sync or async
-
stream
Process expecting a stream of beans response body (typically from json content).- Parameters:
type
- The parameterized type to convert the content to- Returns:
- The HttpCall to execute sync or async
-