Class RestServiceInvoker
java.lang.Object
com.flowable.serviceregistry.engine.impl.invoker.rest.RestServiceInvoker
- All Implemented Interfaces:
ServiceInvoker
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected com.fasterxml.jackson.databind.ObjectMapper
protected ServiceRegistryEngineConfiguration
-
Constructor Summary
ConstructorDescriptionRestServiceInvoker
(ServiceRegistryEngineConfiguration serviceRegistryEngineConfiguration, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addHeader
(MultiValueMap<String, String> headers, String header) protected com.fasterxml.jackson.databind.JsonNode
applyOutputPathIfApplicable
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, com.fasterxml.jackson.databind.JsonNode resultJsonNode) protected boolean
protected int
protected void
configureRequest
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, HttpRequest request, ServiceInvocationVariablesContainer variablesContainer) protected RestServiceInvocationResponse
createCopy
(RestServiceInvocationResponse response, com.fasterxml.jackson.databind.node.ObjectNode responseData) protected FlowableHttpClient
createFlowableHttpClient
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationVariablesContainer variablesContainer, ServiceInvocationContext context, HttpRequest request, ServiceRegistryEngineConfiguration engineConfiguration) protected <T extends HttpResponseHandler & HttpRequestHandler>
TcreateHttpRequestOrResponseHandler
(com.fasterxml.jackson.databind.JsonNode handlerNode, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected HttpRequestHandler
createRequestHandler
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected HttpResponseHandler
createResponseHandler
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected String
protected String
encodeBasicAuth
(String username, String password, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected String
ensureUrlIsEncoded
(String url, ServiceInvocationVariablesContainer variablesContainer) protected URI
execute
(HttpRequest request, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context, ServiceInvocationVariablesContainer serviceDataVariablesContainer) protected RestServiceAuthorization
getAuthorization
(com.fasterxml.jackson.databind.JsonNode config) protected RestServiceAuthorization
getAuthorization
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected String
getBody
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ExpressionManager expressionManager, ServiceInvocationVariablesContainer serviceInvocationVariablesContainer) protected MultiValueMap<String,
String> getHeaders
(com.fasterxml.jackson.databind.JsonNode config, String serviceDefinitionKey, String serviceOperationKey) protected MultiValueMap<String,
String> getHeadersFromGlobalProperties
(String globalPropKey) protected String
getUrl
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected String
handleInputQueryParameters
(String url, VariableContainer variableContainer, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) invoke
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context) invokeList
(ServiceDefinitionModel serviceDefinition, ServiceOperation serviceOperation, ServiceInvocationContext serviceInvocationContext) protected boolean
isJsonContentType
(String value) protected boolean
isJsonContentType
(HttpResponse httpResponse) protected boolean
lookupBooleanProperty
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, boolean defaultValue) protected MultiValueMap<String,
String> lookupHeaders
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected int
lookupIntegerProperty
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, int defaultValue) protected String
lookupStringProperty
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, String defaultValue) perform
(FlowableHttpClient client, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context, HttpRequest httpRequest, ServiceInvocationVariablesContainer variablesContainer) protected void
processInputParameter
(ServiceInvocationVariablesContainer serviceInvocationVariablesContainer, ExpressionManager expressionManager, com.fasterxml.jackson.databind.node.ObjectNode bodyJson, ServiceInputParameter inputParameter) protected String
resolveExpressionAsString
(String value, ExpressionManager expressionManager, ServiceInvocationVariablesContainer variablesContainer) protected MultiValueMap<String,
String> resolveHeaderExpressions
(MultiValueMap<String, String> headers, ExpressionManager expressionManager, ServiceInvocationVariablesContainer variablesContainer) protected boolean
shouldIgnoreErrors
(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) protected void
validate
(HttpRequest request, ServiceInvocationVariablesContainer variablesContainer)
-
Field Details
-
KEY
- See Also:
-
serviceRegistryEngineConfiguration
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
RestServiceInvoker
public RestServiceInvoker(ServiceRegistryEngineConfiguration serviceRegistryEngineConfiguration, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
invoke
public RestServiceInvocationResponse invoke(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context) - Specified by:
invoke
in interfaceServiceInvoker
-
createRequestHandler
protected HttpRequestHandler createRequestHandler(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
createResponseHandler
protected HttpResponseHandler createResponseHandler(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
createHttpRequestOrResponseHandler
protected <T extends HttpResponseHandler & HttpRequestHandler> T createHttpRequestOrResponseHandler(com.fasterxml.jackson.databind.JsonNode handlerNode, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
invokeList
public List<ServiceInvocationResponse> invokeList(ServiceDefinitionModel serviceDefinition, ServiceOperation serviceOperation, ServiceInvocationContext serviceInvocationContext) - Specified by:
invokeList
in interfaceServiceInvoker
-
createCopy
protected RestServiceInvocationResponse createCopy(RestServiceInvocationResponse response, com.fasterxml.jackson.databind.node.ObjectNode responseData) -
configureRequest
protected void configureRequest(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, HttpRequest request, ServiceInvocationVariablesContainer variablesContainer) -
getUrl
protected String getUrl(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
handleInputQueryParameters
protected String handleInputQueryParameters(String url, VariableContainer variableContainer, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
getBody
protected String getBody(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ExpressionManager expressionManager, ServiceInvocationVariablesContainer serviceInvocationVariablesContainer) -
processInputParameter
protected void processInputParameter(ServiceInvocationVariablesContainer serviceInvocationVariablesContainer, ExpressionManager expressionManager, com.fasterxml.jackson.databind.node.ObjectNode bodyJson, ServiceInputParameter inputParameter) -
lookupStringProperty
protected String lookupStringProperty(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, String defaultValue) -
getAuthorization
protected RestServiceAuthorization getAuthorization(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
getAuthorization
-
lookupHeaders
protected MultiValueMap<String,String> lookupHeaders(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
getHeadersFromGlobalProperties
-
getHeaders
protected MultiValueMap<String,String> getHeaders(com.fasterxml.jackson.databind.JsonNode config, String serviceDefinitionKey, String serviceOperationKey) -
addHeader
-
resolveHeaderExpressions
protected MultiValueMap<String,String> resolveHeaderExpressions(MultiValueMap<String, String> headers, ExpressionManager expressionManager, ServiceInvocationVariablesContainer variablesContainer) -
resolveExpressionAsString
protected String resolveExpressionAsString(String value, ExpressionManager expressionManager, ServiceInvocationVariablesContainer variablesContainer) -
lookupIntegerProperty
protected int lookupIntegerProperty(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, int defaultValue) -
asInt
-
lookupBooleanProperty
protected boolean lookupBooleanProperty(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, String field, boolean defaultValue) -
asBoolean
-
applyOutputPathIfApplicable
protected com.fasterxml.jackson.databind.JsonNode applyOutputPathIfApplicable(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, com.fasterxml.jackson.databind.JsonNode resultJsonNode) -
execute
public HttpResponse execute(HttpRequest request, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context, ServiceInvocationVariablesContainer serviceDataVariablesContainer) -
shouldIgnoreErrors
protected boolean shouldIgnoreErrors(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
createFlowableHttpClient
protected FlowableHttpClient createFlowableHttpClient(ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationVariablesContainer variablesContainer, ServiceInvocationContext context, HttpRequest request, ServiceRegistryEngineConfiguration engineConfiguration) -
validate
protected void validate(HttpRequest request, ServiceInvocationVariablesContainer variablesContainer) -
perform
public HttpResponse perform(FlowableHttpClient client, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation, ServiceInvocationContext context, HttpRequest httpRequest, ServiceInvocationVariablesContainer variablesContainer) -
isJsonContentType
-
isJsonContentType
-
encodeBasicAuth
protected String encodeBasicAuth(String username, String password, ServiceDefinitionModel serviceDefinitionModel, ServiceOperation serviceOperation) -
ensureUrlIsEncoded
protected String ensureUrlIsEncoded(String url, ServiceInvocationVariablesContainer variablesContainer) -
ensureUrlIsEncodedAndConvertToUri
- Throws:
URISyntaxException
-
decode
-