public class DefaultRestConnection extends Object implements RestConnection
| Constructor and Description |
|---|
DefaultRestConnection(org.mule.runtime.http.api.client.HttpClient httpClient,
org.mule.runtime.http.api.client.HttpRequestOptions httpRequestOptions,
String baseUri) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
authenticate(org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder httpRequestBuilder)
Allows to different type of connections to intercept the request before sending the HTTP call.
|
String |
getBaseUri() |
org.mule.runtime.http.api.domain.message.response.HttpResponse |
send(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
Synchronous invocation of the
HttpRequest against the connection. |
CompletableFuture<org.mule.runtime.http.api.domain.message.response.HttpResponse> |
sendAsync(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
Asynchronous invocation of the
HttpRequest against this connection. |
org.mule.runtime.api.connection.ConnectionValidationResult |
validate(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
Function<org.mule.runtime.http.api.domain.message.response.HttpResponse,org.mule.runtime.api.connection.ConnectionValidationResult> whenComplete,
Function<Exception,org.mule.runtime.api.connection.ConnectionValidationResult> onError)
Executes the
HttpRequest and validates the response to generate the corresponding ConnectionValidationResult. |
public DefaultRestConnection(org.mule.runtime.http.api.client.HttpClient httpClient,
org.mule.runtime.http.api.client.HttpRequestOptions httpRequestOptions,
String baseUri)
public String getBaseUri()
getBaseUri in interface RestConnectionpublic CompletableFuture<org.mule.runtime.http.api.domain.message.response.HttpResponse> sendAsync(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
RestConnectionHttpRequest against this connection. Allows non-blocking operations to fulfil the SDK
contract for non-blocking support in connectors.sendAsync in interface RestConnectionrequest - to be executed.CompletableFuture to handle the async response.public org.mule.runtime.http.api.domain.message.response.HttpResponse send(org.mule.runtime.http.api.domain.message.request.HttpRequest request)
throws IOException,
TimeoutException
RestConnectionHttpRequest against the connection. Used for design operations like value providers or
even for paging operations where non-blocking is not supported by SDK.send in interface RestConnectionrequest - to be executed.HttpResponse the server response.IOExceptionTimeoutExceptionpublic org.mule.runtime.api.connection.ConnectionValidationResult validate(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
Function<org.mule.runtime.http.api.domain.message.response.HttpResponse,org.mule.runtime.api.connection.ConnectionValidationResult> whenComplete,
Function<Exception,org.mule.runtime.api.connection.ConnectionValidationResult> onError)
RestConnectionHttpRequest and validates the response to generate the corresponding ConnectionValidationResult.validate in interface RestConnectionrequest - to be executed.whenComplete - to process an HttpResponse and return a ConnectionValidationResult.onError - to process an Exception, that happened from client side before calling the server, and return a
ConnectionValidationResult.ConnectionValidationResult.protected void authenticate(org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder httpRequestBuilder)
httpRequestBuilder - HttpRequestBuilder populated with the values from the original HttpRequest.Copyright © 2022. All rights reserved.