Class FlowableClientService
- java.lang.Object
-
- org.flowable.ui.admin.service.engine.FlowableClientService
-
@Service public class FlowableClientService extends Object
Service for invoking Flowable REST services.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FLOWABLE_CONTEXT_ROOTstatic StringDEFAULT_FLOWABLE_REST_ROOTprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected static String[]PAGING_AND_SORTING_PARAMETER_NAMESprotected ServerConfigServiceserverConfigService
-
Constructor Summary
Constructors Constructor Description FlowableClientService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameterToBuilder(String name, com.fasterxml.jackson.databind.JsonNode bodyNode, org.apache.http.client.utils.URIBuilder builder)org.apache.http.client.methods.HttpDeletecreateDelete(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)org.apache.http.client.methods.HttpPostcreatePost(String uri, ServerConfig serverConfig)org.apache.http.client.methods.HttpPostcreatePost(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)org.apache.http.client.methods.HttpPutcreatePut(String uri, ServerConfig serverConfig)org.apache.http.client.methods.HttpPutcreatePut(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)org.apache.http.entity.StringEntitycreateStringEntity(com.fasterxml.jackson.databind.JsonNode json)org.apache.http.entity.StringEntitycreateStringEntity(String json)org.apache.http.client.utils.URIBuildercreateUriBuilder(String url)ResponseInfoexecute(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, int... expectedStatusCodes)voidexecute(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, String userName, String password)voidexecute(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig)ResponseInfoexecute(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)ResponseInfoexecute(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int... expectedStatusCodes)AttachmentResponseInfoexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password)AttachmentResponseInfoexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, Integer... expectedStatusCodes)com.fasterxml.jackson.databind.JsonNodeexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, String userName, String password, int expectedStatusCode)com.fasterxml.jackson.databind.JsonNodeexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig)com.fasterxml.jackson.databind.JsonNodeexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig, int expectedStatusCode)AttachmentResponseInfoexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)AttachmentResponseInfoexecuteDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, Integer... expectedStatusCodes)com.fasterxml.jackson.databind.JsonNodeexecuteRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password)com.fasterxml.jackson.databind.JsonNodeexecuteRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, int expectedStatusCode)Execute the given request.com.fasterxml.jackson.databind.JsonNodeexecuteRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)Execute the given request.com.fasterxml.jackson.databind.JsonNodeexecuteRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)StringexecuteRequestAsString(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)voidexecuteRequestNoResponseBody(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)Execute the given request, without using the response body.StringextractError(com.fasterxml.jackson.databind.JsonNode errorBody, String defaultValue)StringgetAppServerUrl(ServerConfig serverConfig, String uri)org.apache.http.impl.client.CloseableHttpClientgetHttpClient(String userName, String password)org.apache.http.impl.client.CloseableHttpClientgetHttpClient(ServerConfig serverConfig)StringgetServerUrl(String contextRoot, String restRoot, String serverAddress, Integer port, String uri)StringgetServerUrl(ServerConfig serverConfig, String uri)StringgetServerUrl(ServerConfig serverConfig, org.apache.http.client.utils.URIBuilder builder)StringgetUriWithPagingAndOrderParameters(org.apache.http.client.utils.URIBuilder builder, com.fasterxml.jackson.databind.JsonNode bodyNode)protected com.fasterxml.jackson.databind.JsonNodereadJsonContent(InputStream requestContent)protected StringstripSlashes(String url)FlowableServiceExceptionwrapException(Exception e, org.apache.http.client.methods.HttpUriRequest request)
-
-
-
Field Detail
-
PAGING_AND_SORTING_PARAMETER_NAMES
protected static final String[] PAGING_AND_SORTING_PARAMETER_NAMES
-
DEFAULT_FLOWABLE_CONTEXT_ROOT
public static final String DEFAULT_FLOWABLE_CONTEXT_ROOT
- See Also:
- Constant Field Values
-
DEFAULT_FLOWABLE_REST_ROOT
public static final String DEFAULT_FLOWABLE_REST_ROOT
- See Also:
- Constant Field Values
-
serverConfigService
@Autowired protected ServerConfigService serverConfigService
-
objectMapper
@Autowired protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Method Detail
-
getHttpClient
public org.apache.http.impl.client.CloseableHttpClient getHttpClient(ServerConfig serverConfig)
-
getHttpClient
public org.apache.http.impl.client.CloseableHttpClient getHttpClient(String userName, String password)
-
executeRequest
public com.fasterxml.jackson.databind.JsonNode executeRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)Execute the given request. Will return the parsed JSON present in the response-body, in case the status code is 200 - OK. In case the response returns a different status-code, anFlowableServiceExceptionis thrown with the error message received from the client, if possible.
-
executeRequest
public com.fasterxml.jackson.databind.JsonNode executeRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)
-
executeRequest
public com.fasterxml.jackson.databind.JsonNode executeRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password)
-
executeRequest
public com.fasterxml.jackson.databind.JsonNode executeRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, int expectedStatusCode)Execute the given request. Will return the parsed JSON present in the response-body, in case the status code is as expected. In case the response returns a different status-code, anFlowableServiceExceptionis thrown with the error message received from the client, if possible.
-
executeDownloadRequest
public com.fasterxml.jackson.databind.JsonNode executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig)
-
executeDownloadRequest
public com.fasterxml.jackson.databind.JsonNode executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig, int expectedStatusCode)
-
executeDownloadRequest
public com.fasterxml.jackson.databind.JsonNode executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, String userName, String password, int expectedStatusCode)
-
executeDownloadRequest
public AttachmentResponseInfo executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)
-
executeDownloadRequest
public AttachmentResponseInfo executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, Integer... expectedStatusCodes)
-
executeDownloadRequest
public AttachmentResponseInfo executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password)
-
executeDownloadRequest
public AttachmentResponseInfo executeDownloadRequest(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, Integer... expectedStatusCodes)
-
execute
public ResponseInfo execute(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig)
-
execute
public ResponseInfo execute(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int... expectedStatusCodes)
-
execute
public ResponseInfo execute(org.apache.http.client.methods.HttpUriRequest request, String userName, String password, int... expectedStatusCodes)
-
execute
public void execute(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, ServerConfig serverConfig)
-
execute
public void execute(org.apache.http.client.methods.HttpUriRequest request, javax.servlet.http.HttpServletResponse httpResponse, String userName, String password)
-
executeRequestAsString
public String executeRequestAsString(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)
-
wrapException
public FlowableServiceException wrapException(Exception e, org.apache.http.client.methods.HttpUriRequest request)
-
executeRequestNoResponseBody
public void executeRequestNoResponseBody(org.apache.http.client.methods.HttpUriRequest request, ServerConfig serverConfig, int expectedStatusCode)Execute the given request, without using the response body. In case the response returns a different status-code than expected, anFlowableServiceExceptionis thrown with the error message received from the client, if possible.
-
extractError
public String extractError(com.fasterxml.jackson.databind.JsonNode errorBody, String defaultValue)
-
createPost
public org.apache.http.client.methods.HttpPost createPost(String uri, ServerConfig serverConfig)
-
createPost
public org.apache.http.client.methods.HttpPost createPost(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)
-
createPut
public org.apache.http.client.methods.HttpPut createPut(String uri, ServerConfig serverConfig)
-
createPut
public org.apache.http.client.methods.HttpPut createPut(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)
-
createDelete
public org.apache.http.client.methods.HttpDelete createDelete(org.apache.http.client.utils.URIBuilder builder, ServerConfig serverConfig)
-
createStringEntity
public org.apache.http.entity.StringEntity createStringEntity(com.fasterxml.jackson.databind.JsonNode json)
-
createStringEntity
public org.apache.http.entity.StringEntity createStringEntity(String json)
-
getServerUrl
public String getServerUrl(ServerConfig serverConfig, String uri)
-
getServerUrl
public String getServerUrl(String contextRoot, String restRoot, String serverAddress, Integer port, String uri)
-
getAppServerUrl
public String getAppServerUrl(ServerConfig serverConfig, String uri)
-
createUriBuilder
public org.apache.http.client.utils.URIBuilder createUriBuilder(String url)
-
getServerUrl
public String getServerUrl(ServerConfig serverConfig, org.apache.http.client.utils.URIBuilder builder)
-
getUriWithPagingAndOrderParameters
public String getUriWithPagingAndOrderParameters(org.apache.http.client.utils.URIBuilder builder, com.fasterxml.jackson.databind.JsonNode bodyNode) throws URISyntaxException
- Throws:
URISyntaxException
-
addParameterToBuilder
public void addParameterToBuilder(String name, com.fasterxml.jackson.databind.JsonNode bodyNode, org.apache.http.client.utils.URIBuilder builder)
-
readJsonContent
protected com.fasterxml.jackson.databind.JsonNode readJsonContent(InputStream requestContent)
-
-