Class FlowableClientService


  • @Service
    public class FlowableClientService
    extends Object
    Service for invoking Flowable REST services.
    • Field Detail

      • PAGING_AND_SORTING_PARAMETER_NAMES

        protected static final String[] PAGING_AND_SORTING_PARAMETER_NAMES
      • objectMapper

        @Autowired
        protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • Constructor Detail

      • FlowableClientService

        public FlowableClientService()
    • 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, an FlowableServiceException is 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, an FlowableServiceException is 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,
                                                             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)
      • 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, an FlowableServiceException is 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)
      • 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)
      • stripSlashes

        protected String stripSlashes​(String url)
      • readJsonContent

        protected com.fasterxml.jackson.databind.JsonNode readJsonContent​(InputStream requestContent)