public abstract class BaseRestOperation extends Object
| Constructor and Description |
|---|
BaseRestOperation()
Default constructor used by Mule/SDK to instantiate this operation.
|
BaseRestOperation(org.mule.runtime.api.el.ExpressionLanguage expressionLanguage)
Constructor to allow creating an operation without using IoC from Mule/SDK.
|
| Modifier and Type | Method and Description |
|---|---|
protected <T> org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,HttpResponseAttributes> |
callbackObjectAttributesAdapter(org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,Object> callback) |
protected void |
doRequest(RestConfiguration config,
RestConnection connection,
RestRequestBuilder builder,
int responseTimeoutMillis,
Map<String,Object> parameterBindings,
Map<String,Object> customParameterBindings,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<InputStream,HttpResponseAttributes> callback)
Performs the request using the given
builder and connection and completes the callback accordingly. |
protected void |
doVoidRequest(RestConnection connection,
RestRequestBuilder builder,
int responseTimeoutMillis,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback)
Performs the request using the given
builder and connection and completes the callback accordingly,
expecting the response to not contain a body. |
protected org.mule.runtime.api.metadata.MediaType |
getDefaultResponseMediaType()
This method specifies the
MediaType that should be assumed the response to have in case the remote service doesn't
specify a Content-Type header. |
protected org.mule.runtime.api.el.ExpressionLanguage |
getExpressionLanguage() |
protected HttpRequestBinding |
getRequestBindings() |
protected String |
getRequestBodyMediaType() |
protected RestRequestBuilder |
getRequestBuilderWithBindings(String baseUri,
String path,
org.mule.runtime.http.api.HttpConstants.Method method,
RequestParameters requestParameters,
ConfigurationOverrides overrides,
RestConnection connection,
RestConfiguration config,
Map<String,Object> parameterBindings,
Map<String,Object> customParameterBindings) |
protected HttpResponseBinding |
getResponseBindings() |
protected String |
getResponseBodyMediaType() |
protected HttpResponseInterceptorDescriptor |
getResponseInterceptorDescriptor(RestConfiguration config)
This method return the http response interceptor descriptor from the configuration.
|
protected <T> BiConsumer<org.mule.runtime.extension.api.runtime.operation.Result<T,HttpResponseAttributes>,Throwable> |
handleResponse(org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,HttpResponseAttributes> callback,
Map<String,Object> parameterBindings,
Map<String,Object> customParameterBindings) |
protected org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> |
postProcessResult(org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> result,
Map<String,Object> parameterBindings,
Map<String,Object> customParameterBindings) |
protected org.mule.runtime.api.metadata.MediaType |
resolveDefaultResponseMediaType(RestConfiguration config) |
protected <T> org.mule.runtime.extension.api.runtime.operation.Result<T,Object> |
toObjectResult(org.mule.runtime.extension.api.runtime.operation.Result<? super T,HttpResponseAttributes> result) |
protected <T,A> void |
withMultipart(Consumer<MultipartPayloadBuilder> builderConfigurer,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,A> callback,
BiConsumer<org.mule.runtime.api.metadata.TypedValue<InputStream>,org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,A>> consumer)
Allows to make a multipart request by facilitating the construction of the multipart body through a
MultipartPayloadBuilder. |
public BaseRestOperation()
public BaseRestOperation(org.mule.runtime.api.el.ExpressionLanguage expressionLanguage)
expressionLanguage - protected void doRequest(RestConfiguration config, RestConnection connection, RestRequestBuilder builder, int responseTimeoutMillis, Map<String,Object> parameterBindings, Map<String,Object> customParameterBindings, org.mule.runtime.extension.api.runtime.process.CompletionCallback<InputStream,HttpResponseAttributes> callback)
builder and connection and completes the callback accordingly.config - the operation's configconnection - the connection to usebuilder - the request builderresponseTimeoutMillis - the request timeout in milliscallback - the operation's CompletionCallbackprotected org.mule.runtime.api.metadata.MediaType resolveDefaultResponseMediaType(RestConfiguration config)
protected void doVoidRequest(RestConnection connection, RestRequestBuilder builder, int responseTimeoutMillis, org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback)
builder and connection and completes the callback accordingly,
expecting the response to not contain a body.
If successful, the callback will be completed with an empty String as payload.
connection - the connection to usebuilder - the request builderresponseTimeoutMillis - the request timeout in milliscallback - the operation's CompletionCallbackprotected <T> BiConsumer<org.mule.runtime.extension.api.runtime.operation.Result<T,HttpResponseAttributes>,Throwable> handleResponse(org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,HttpResponseAttributes> callback, Map<String,Object> parameterBindings, Map<String,Object> customParameterBindings)
protected <T,A> void withMultipart(Consumer<MultipartPayloadBuilder> builderConfigurer, org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,A> callback, BiConsumer<org.mule.runtime.api.metadata.TypedValue<InputStream>,org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,A>> consumer)
MultipartPayloadBuilder.
This operation MUST NOT be completed using the callback passed as a parameter, but the one provided through
the consumer
T - the generic type of the callback payload typeA - the generic type of the callback attributes typebuilderConfigurer - a Consumer which gives access to the MultipartPayloadBuilder and allows to configure
itcallback - the operation's CompletionCallbackconsumer - the Consumer which gives access to the built multipart body and the effective callback that should
complete this operationprotected org.mule.runtime.api.metadata.MediaType getDefaultResponseMediaType()
MediaType that should be assumed the response to have in case the remote service doesn't
specify a Content-Type header.
By default, this method returns MediaType.APPLICATION_JSON since it's the most common response type. However, this
method should be overwritten if a different type of media type is to be expected, or if you know that a certain encoding will
be enforced.
MediaType to assign the response in case the server doesn't specify one in its responseprotected org.mule.runtime.api.el.ExpressionLanguage getExpressionLanguage()
protected RestRequestBuilder getRequestBuilderWithBindings(String baseUri, String path, org.mule.runtime.http.api.HttpConstants.Method method, RequestParameters requestParameters, ConfigurationOverrides overrides, RestConnection connection, RestConfiguration config, Map<String,Object> parameterBindings, Map<String,Object> customParameterBindings)
protected String getRequestBodyMediaType()
protected String getResponseBodyMediaType()
protected HttpRequestBinding getRequestBindings()
protected HttpResponseBinding getResponseBindings()
protected org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> postProcessResult(org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> result, Map<String,Object> parameterBindings, Map<String,Object> customParameterBindings)
protected <T> org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,HttpResponseAttributes> callbackObjectAttributesAdapter(org.mule.runtime.extension.api.runtime.process.CompletionCallback<T,Object> callback)
protected <T> org.mule.runtime.extension.api.runtime.operation.Result<T,Object> toObjectResult(org.mule.runtime.extension.api.runtime.operation.Result<? super T,HttpResponseAttributes> result)
protected HttpResponseInterceptorDescriptor getResponseInterceptorDescriptor(RestConfiguration config)
config - rest configuration to get the default interceptorsCopyright © 2022. All rights reserved.