@NoImplement
public interface HttpClient
| Modifier and Type | Method and Description |
|---|---|
default CompletableFuture<WebSocket> |
openWebSocket(HttpRequest request,
HttpRequestOptions requestOptions,
String socketId,
WebSocketCallback callback)
Opens a new WebSocket by adding the proper upgrade header to the given
request |
default CompletableFuture<WebSocket> |
openWebSocket(HttpRequest request,
String socketId,
WebSocketCallback callback)
Opens a new WebSocket by adding the proper upgrade header to the given
request |
default HttpResponse |
send(HttpRequest request)
Same as
send(HttpRequest, HttpRequestOptions) but using default options. |
HttpResponse |
send(HttpRequest request,
HttpRequestOptions options)
Sends a HttpRequest blocking the current thread until a response is available or the request times out.
|
default HttpResponse |
send(HttpRequest request,
int responseTimeout,
boolean followRedirects,
HttpAuthentication authentication)
Deprecated.
use
send(HttpRequest, HttpRequestOptions) instead |
default CompletableFuture<HttpResponse> |
sendAsync(HttpRequest request)
Same as
sendAsync(HttpRequest, HttpRequestOptions) but using default options. |
CompletableFuture<HttpResponse> |
sendAsync(HttpRequest request,
HttpRequestOptions options)
Sends a HttpRequest without blocking the current thread.
|
default CompletableFuture<HttpResponse> |
sendAsync(HttpRequest request,
int responseTimeout,
boolean followRedirects,
HttpAuthentication authentication)
Deprecated.
use
sendAsync(HttpRequest, HttpRequestOptions) instead |
void |
start()
Fully configures the client, leaving it ready to use.
|
void |
stop()
Disables the client.
|
void start()
void stop()
@Deprecated default HttpResponse send(HttpRequest request, int responseTimeout, boolean followRedirects, HttpAuthentication authentication) throws IOException, TimeoutException
send(HttpRequest, HttpRequestOptions) insteadrequest - the HttpRequest to sendresponseTimeout - the time (in milliseconds) to wait for a responsefollowRedirects - whether or not to follow redirect responsesauthentication - the optional HttpAuthentication to useHttpResponseIOException - if an error occurs while executingTimeoutException - if responseTimeout is exceededdefault HttpResponse send(HttpRequest request) throws IOException, TimeoutException
send(HttpRequest, HttpRequestOptions) but using default options.request - the HttpRequest to sendHttpResponseIOException - if an error occurs while executingTimeoutException - if responseTimeout is exceededHttpResponse send(HttpRequest request, HttpRequestOptions options) throws IOException, TimeoutException
request - the HttpRequest to sendoptions - the HttpRequestOptions to useHttpResponseIOException - if an error occurs while executingTimeoutException - if responseTimeout is exceeded@Deprecated default CompletableFuture<HttpResponse> sendAsync(HttpRequest request, int responseTimeout, boolean followRedirects, HttpAuthentication authentication)
sendAsync(HttpRequest, HttpRequestOptions) insteadCompletableFuture will be completed. Be aware that the response body processing will be deferred so that the response
can be processed even when a large body is still being received. If the full response is needed right away then the provided
HttpResponse must be read in a different thread so that it does not block the HttpClient threads handling the
response. It's therefore recommended to use CompletableFuture.get() or any of the async methods available, such as
CompletableFuture.whenCompleteAsync(BiConsumer, Executor), to handle the response is those scenarios since they
guarantee executing on a different thread.request - the HttpRequest to sendresponseTimeout - the time (in milliseconds) to wait for a responsefollowRedirects - whether or not to follow redirect responsesauthentication - the optional HttpAuthentication to useCompletableFuture that will complete once the HttpResponse is availabledefault CompletableFuture<HttpResponse> sendAsync(HttpRequest request)
sendAsync(HttpRequest, HttpRequestOptions) but using default options.request - the HttpRequest to sendCompletableFuture that will complete once the HttpResponse is availableCompletableFuture<HttpResponse> sendAsync(HttpRequest request, HttpRequestOptions options)
CompletableFuture will be completed. Be aware that the response body processing will be deferred so that the response
can be processed even when a large body is still being received. If the full response is needed right away then the provided
HttpResponse must be read in a different thread so that it does not block the HttpClient threads handling the
response. It's therefore recommended to use CompletableFuture.get() or any of the async methods available, such as
CompletableFuture.whenCompleteAsync(BiConsumer, Executor), to handle the response is those scenarios since they
guarantee executing on a different thread.request - the HttpRequest to sendoptions - the HttpRequestOptions to useCompletableFuture that will complete once the HttpResponse is availabledefault CompletableFuture<WebSocket> openWebSocket(HttpRequest request, String socketId, WebSocketCallback callback)
requestrequest - a HttpRequest to the target WebSocket endpointsocketId - the id of the obtained socketcallback - the callback that will receive the associated socket eventsWebSocketdefault CompletableFuture<WebSocket> openWebSocket(HttpRequest request, HttpRequestOptions requestOptions, String socketId, WebSocketCallback callback)
requestrequest - a HttpRequest to the target WebSocket endpointrequestOptions - the request optionssocketId - the id of the obtained socketcallback - the callback that will receive the associated socket eventsWebSocketCopyright © 2003–2021 MuleSoft, Inc.. All rights reserved.