public abstract class BaseRestOperation extends Object
| Constructor and Description |
|---|
BaseRestOperation() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addParameterToBindingContext(String key,
Object parameter) |
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,
org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper,
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.streaming.StreamingHelper streamingHelper,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,HttpResponseAttributes> 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) |
protected HttpResponseBinding |
getResponseBindings() |
protected String |
getResponseBodyMediaType() |
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) |
protected org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> |
postProcessResult(org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes> result) |
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. |
protected void doRequest(RestConfiguration config, RestConnection connection, RestRequestBuilder builder, int responseTimeoutMillis, org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper, 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 millisstreamingHelper - the StreamingHelpercallback - 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.streaming.StreamingHelper streamingHelper, org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,HttpResponseAttributes> 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 millisstreamingHelper - the StreamingHelpercallback - 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)
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 void addParameterToBindingContext(String key, Object parameter)
protected RestRequestBuilder getRequestBuilderWithBindings(String baseUri, String path, org.mule.runtime.http.api.HttpConstants.Method method, RequestParameters requestParameters, ConfigurationOverrides overrides)
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)
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)
Copyright © 2021. All rights reserved.