Class AbstractKieServicesClientImpl

    • Method Detail

      • initializeURI

        protected String initializeURI​(URL url,
                                       String servicePrefix)
        Initializes the URL that will be used for web service access
        Parameters:
        url - URL of the server instance
        Returns:
        An URL that can be used for the web services
      • setResponseHandler

        public void setResponseHandler​(ResponseHandler responseHandler)
      • throwExceptionOnFailure

        protected void throwExceptionOnFailure​(org.kie.server.api.model.ServiceResponse<?> serviceResponse)
      • shouldReturnWithNullResponse

        protected boolean shouldReturnWithNullResponse​(org.kie.server.api.model.ServiceResponse<?> serviceResponse)
      • sendTaskOperation

        protected void sendTaskOperation​(String containerId,
                                         Long taskId,
                                         String operation,
                                         String queryString)
      • sendTaskOperation

        protected void sendTaskOperation​(String containerId,
                                         Long taskId,
                                         String operation,
                                         String queryString,
                                         Object data)
      • makeHttpGetRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpGetRequestAndCreateServiceResponse​(String uri,
                                                                                                             Class<T> resultType)
      • makeHttpGetRequestAndCreateCustomResponse

        protected <T> T makeHttpGetRequestAndCreateCustomResponse​(String uri,
                                                                  Class<T> resultType)
      • makeHttpGetRequestAndCreateCustomResponseWithHandleNotFound

        protected <T> T makeHttpGetRequestAndCreateCustomResponseWithHandleNotFound​(String uri,
                                                                                    Class<T> resultType)
      • makeHttpGetRequestAndCreateRawResponse

        protected String makeHttpGetRequestAndCreateRawResponse​(String uri)
      • makeHttpGetRequestAndCreateRawResponse

        protected String makeHttpGetRequestAndCreateRawResponse​(String uri,
                                                                Map<String,​String> headers)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              Object bodyObject,
                                                                                                              Class<T> resultType)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              Object bodyObject,
                                                                                                              Class<T> resultType,
                                                                                                              Map<String,​String> headers)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              Object bodyObject,
                                                                                                              Class<T> resultType,
                                                                                                              Map<String,​String> headers,
                                                                                                              javax.ws.rs.core.Response.Status status)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              String body,
                                                                                                              Class<T> resultType)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              String body,
                                                                                                              Class<T> resultType,
                                                                                                              Map<String,​String> headers)
      • makeHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                              String body,
                                                                                                              Class<T> resultType,
                                                                                                              Map<String,​String> headers,
                                                                                                              javax.ws.rs.core.Response.Status status)
      • makeHttpPostRequestAndCreateCustomResponse

        protected <T> T makeHttpPostRequestAndCreateCustomResponse​(String uri,
                                                                   Object bodyObject,
                                                                   Class<T> resultType,
                                                                   Map<String,​String> headers)
      • makeHttpPostRequestAndCreateCustomResponse

        protected <T> T makeHttpPostRequestAndCreateCustomResponse​(String uri,
                                                                   Object bodyObject,
                                                                   Class<T> resultType)
      • makeHttpPostRequestAndCreateCustomResponse

        protected <T> T makeHttpPostRequestAndCreateCustomResponse​(String uri,
                                                                   String body,
                                                                   Class<T> resultType,
                                                                   Map<String,​String> headers)
      • makeHttpPutRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPutRequestAndCreateServiceResponse​(String uri,
                                                                                                             Object bodyObject,
                                                                                                             Class<T> resultType)
      • makeHttpPutRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpPutRequestAndCreateServiceResponse​(String uri,
                                                                                                             String body,
                                                                                                             Class<T> resultType)
      • makeHttpPutRequestAndCreateCustomResponse

        protected <T> T makeHttpPutRequestAndCreateCustomResponse​(String uri,
                                                                  Object bodyObject,
                                                                  Class<T> resultType,
                                                                  Map<String,​String> headers)
      • makeHttpPutRequestAndCreateCustomResponse

        protected <T> T makeHttpPutRequestAndCreateCustomResponse​(String uri,
                                                                  String body,
                                                                  Class<T> resultType,
                                                                  Map<String,​String> headers)
      • makeHttpDeleteRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeHttpDeleteRequestAndCreateServiceResponse​(String uri,
                                                                                                                Class<T> resultType)
      • makeHttpDeleteRequestAndCreateCustomResponse

        protected <T> T makeHttpDeleteRequestAndCreateCustomResponse​(String uri,
                                                                     Class<T> resultType)
      • newRequest

        protected org.kie.server.common.rest.KieServerHttpRequest newRequest​(String uri)
      • executeJmsCommand

        protected org.kie.server.api.model.ServiceResponsesList executeJmsCommand​(org.kie.server.api.commands.CommandScript command)
        Method to communicate with the backend via JMS.
        Parameters:
        command - The Command object to be executed.
        Returns:
        The result of the Command object execution.
      • executeJmsCommand

        protected org.kie.server.api.model.ServiceResponsesList executeJmsCommand​(org.kie.server.api.commands.CommandScript command,
                                                                                  String classType)
      • executeJmsCommand

        protected org.kie.server.api.model.ServiceResponsesList executeJmsCommand​(org.kie.server.api.commands.CommandScript command,
                                                                                  String classType,
                                                                                  String targetCapability)
      • executeJmsCommand

        protected org.kie.server.api.model.ServiceResponsesList executeJmsCommand​(org.kie.server.api.commands.CommandScript command,
                                                                                  String classType,
                                                                                  String targetCapability,
                                                                                  String containerId)
      • getMediaType

        protected String getMediaType​(org.kie.server.api.marshalling.MarshallingFormat format)
      • deserialize

        protected <T> T deserialize​(String content,
                                    Class<T> type)
      • checkResultType

        protected void checkResultType​(org.kie.server.api.model.ServiceResponse<?> serviceResponse,
                                       Class<?> expectedResultType)
        Checks whether the specified ServiceResponse contains the expected result type. In case the type is different, KieServicesClientException is thrown. This catches the errors early, before returning the result from the client. Without this check users could experience ClassCastException when retrieving the result that does not have the expected type.
      • createExceptionForUnexpectedResponseCode

        protected RuntimeException createExceptionForUnexpectedResponseCode​(org.kie.server.common.rest.KieServerHttpRequest request,
                                                                            org.kie.server.common.rest.KieServerHttpResponse response)
      • getMessage

        protected String getMessage​(org.kie.server.common.rest.KieServerHttpResponse response)
      • buildQueryString

        protected String buildQueryString​(String paramName,
                                          List<?> items)
      • getUserQueryStr

        protected String getUserQueryStr​(String userId,
                                         char prefix)
      • getUserQueryStr

        protected String getUserQueryStr​(String userId)
      • getUserAndAdditionalParam

        protected String getUserAndAdditionalParam​(String userId,
                                                   String name,
                                                   String value)
      • getUserAndAdditionalParams

        protected String getUserAndAdditionalParams​(String userId,
                                                    String name,
                                                    List<?> values)
      • getSortingQueryString

        protected String getSortingQueryString​(String inQueryString,
                                               String sort,
                                               boolean sortOrder)
      • getAdditionalParams

        protected String getAdditionalParams​(String inQueryString,
                                             String name,
                                             List<?> values)
      • safeMap

        protected Map<?,​?> safeMap​(Map<?,​?> map)
      • safeList

        protected List<?> safeList​(List<?> list)
      • makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                                                Object body,
                                                                                                                                Class<T> resultType,
                                                                                                                                Map<String,​String> headers)
      • makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                                                Object body,
                                                                                                                                Class<T> resultType,
                                                                                                                                Map<String,​String> headers,
                                                                                                                                javax.ws.rs.core.Response.Status expectedStatus)
      • makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse

        protected <T> org.kie.server.api.model.ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse​(String uri,
                                                                                                                                String body,
                                                                                                                                Class<T> resultType)
      • getConversationId

        public String getConversationId()
      • invoke

        protected org.kie.server.common.rest.KieServerHttpRequest invoke​(String url,
                                                                         org.kie.server.client.impl.AbstractKieServicesClientImpl.RemoteHttpOperation operation)
      • close

        protected void close()