public interface RestConnection
HttpRequest to the server and generate the for the response with the body and HTTP protocol attributes. It also validates if the
server is valid. It handles responses according to the error handling definition, if a request generates a failure response it
will throw a ModuleException with the specific ErrorType defined for it.| Modifier and Type | Method and Description |
|---|---|
String |
getBaseUri() |
HttpResponseResult |
send(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
org.mule.runtime.api.metadata.MediaType defaultResponseMediaType)
Synchronous invocation of the
HttpRequest against the connection. |
CompletableFuture<HttpResponseResult> |
sendAsync(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
org.mule.runtime.api.metadata.MediaType defaultResponseMediaType)
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. |
String getBaseUri()
CompletableFuture<HttpResponseResult> sendAsync(org.mule.runtime.http.api.domain.message.request.HttpRequest request, org.mule.runtime.api.metadata.MediaType defaultResponseMediaType)
HttpRequest against this connection. Allows non-blocking operations to fulfil the SDK
contract for non-blocking support in connectors.request - to be executed.defaultResponseMediaType - to be used if the server doesn't specify one with the
HttpHeaders.Names.CONTENT_TYPE header.HttpResponseResult > to handle the async response. CompletableFuture will success if the
response from the server is success, case of a failure a ModuleException would be passed to the
completeExceptionally. The HttpResponseResult provides the MediaType for the output
InputStream.HttpResponseResult send(org.mule.runtime.http.api.domain.message.request.HttpRequest request, org.mule.runtime.api.metadata.MediaType defaultResponseMediaType) throws org.mule.runtime.extension.api.exception.ModuleException
HttpRequest against the connection. Used for design operations like value providers or
even for paging operations where non-blocking is not supported by SDK.request - to be executed.defaultResponseMediaType - to be used if the server doesn't specify one with the
HttpHeaders.Names.CONTENT_TYPE header. with the response body and HTTP protocol attributes
from the server. The HttpResponseResult provides the MediaType for the output InputStream.{@link - ModuleException} in case if the response is a failure, a timeout or an error while trying to reach out the
server happened when sending the request.org.mule.runtime.extension.api.exception.ModuleExceptionorg.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)
HttpRequest and validates the response to generate the corresponding ConnectionValidationResult.request - 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.Copyright © 2023. All rights reserved.