public abstract class BaseRestConnectOperation extends Object
| Constructor and Description |
|---|
BaseRestConnectOperation() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doRequest(RestConnectConfiguration config,
RestConnection connection,
org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder 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,
org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder 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.http.api.domain.message.request.HttpRequestBuilder |
requestBuilder(String baseUri,
String path,
org.mule.runtime.http.api.HttpConstants.Method method,
RequestParameters parameters)
Creates a preconfigured
HttpRequestBuilder per the given parameters. |
protected org.mule.runtime.api.metadata.MediaType |
resolveDefaultResponseMediaType(RestConnectConfiguration config) |
protected void |
setBody(org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder builder,
org.mule.runtime.api.metadata.TypedValue<InputStream> body)
Sets the request body, and media-type and content-length headers from it if those are not already defined.
|
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(RestConnectConfiguration config, RestConnection connection, org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder 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(RestConnectConfiguration config)
protected void doVoidRequest(RestConnection connection, org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder 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 void setBody(org.mule.runtime.http.api.domain.message.request.HttpRequestBuilder builder,
org.mule.runtime.api.metadata.TypedValue<InputStream> body)
builder - the request builderbody - the request body (nullable)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.http.api.domain.message.request.HttpRequestBuilder requestBuilder(String baseUri, String path, org.mule.runtime.http.api.HttpConstants.Method method, RequestParameters parameters)
HttpRequestBuilder per the given parameters.
This creates a new HttpRequestBuilder and initializes it's URI, method, custom query params and custom headers.
The returned builder can still to add/change additional information.
baseUri - the base uri to be usedpath - the path of the resource to request, relative to the base URImethod - the request methodparameters - the request parametersHttpRequestBuilderprotected 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 responseCopyright © 2019. All rights reserved.