Package org.jbpm.process.workitem.rest

## Class RESTWorkItemHandler

- java.lang.Object
- - org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler
  - - org.jbpm.process.workitem.rest.RESTWorkItemHandler

- All Implemented Interfaces:
    `org.kie.api.runtime.process.WorkItemHandler`, `org.kie.internal.runtime.Cacheable`

      @Wid(widfile="RestDefinitions.wid",name="Rest",displayName="Rest",defaultHandler="mvel: new org.jbpm.process.workitem.rest.RESTWorkItemHandler()",documentation="jbpm-workitems-rest/index.html",category="jbpm-workitems-rest",icon="defaultresticon.png",parameters={@WidParameter(name="Url"),@WidParameter(name="Method"),@WidParameter(name="HandleResponseErrors"),@WidParameter(name="ResultClass"),@WidParameter(name="AcceptHeader"),@WidParameter(name="AcceptCharset"),@WidParameter(name="Headers"),@WidParameter(name="AuthType"),@WidParameter(name="ConnectTimeout"),@WidParameter(name="ReadTimeout"),@WidParameter(name="Content"),@WidParameter(name="ContentData"),@WidParameter(name="Username"),@WidParameter(name="Password"),@WidParameter(name="AuthUrl"),@WidParameter(name="ContentType"),@WidParameter(name="ContentTypeCharset"),@WidParameter(name="Cookie"),@WidParameter(name="CookiePath")},results=@WidResult(name="Result",runtimeType="java.lang.Object"),mavenDepends=@WidMavenDepends(group="org.jbpm",artifact="jbpm-workitems-rest",version="7.71.0.Final"),serviceInfo=@WidService(category="REST",description="Perform REST calls",keywords="rest,call",action=@WidAction(title="Perform a Rest call"),authinfo=@WidAuth(required=true,params={"username","password"},paramsdescription={"User Name","Password"})))
      public class RESTWorkItemHandler
      extends AbstractLogOrThrowWorkItemHandler
      implements org.kie.internal.runtime.Cacheable

  WorkItemHandler that is capable of interacting with REST service. Supports both types of services secured (that requires authentication) and open (no authentication). Authentication methods currently supported:
  - BASIC
  - FORM BASED
  Authentication information can be given on handler initialization and can be overridden via work item parameters. All other configuration options must be given via work item parameters map:
  - Url - resource location to be invoked - mandatory
  - Method - HTTP method that will be executed - defaults to GET
  - ContentType - data type in case of sending data - mandatory for POST,PUT
  - ContentData - actual data to be sent - mandatory for POST,PUT
  - ConnectTimeout - connection time out - default to 60 seconds
  - ReadTimeout - read time out - default to 60 seconds
  - Username - user name for authentication - overrides one given on handler initialization)
  - Password - password for authentication - overrides one given on handler initialization)
  - AuthUrl - url that is handling authentication (usually j_security_check url)
  - HandleResponseErrors - optional parameter that instructs handler to throw errors in case of non successful response codes (other than 2XX)
  - ResultClass - fully qualified class name of the class that response should be transformed to, if not given string format will be returned
  - AcceptHeader - accept header value
  - Headers - additional HTTP Headers in format: header1=val1;header2=val2
  - Cookie - Cookie need to send while accessing REST API in format: cookieParam1=cookieParam1_Value;cookieParam2=cookieParam2_Value
  - CookiePath - Define path for which the cookie is valid - default set to /

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `RESTWorkItemHandler.AuthenticationType` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected static org.apache.http.impl.client.CloseableHttpClient` | `cachedClient` |
    `protected static org.apache.http.impl.conn.PoolingHttpClientConnectionManager` | `connectionManager` |
    `protected static boolean` | `HTTP_CLIENT_API_43` |
    `static String` | `PARAM_AUTH_TYPE` |
    `static String` | `PARAM_AUTHURL` |
    `static String` | `PARAM_CONNECT_TIMEOUT` |
    `static String` | `PARAM_CONTENT` |
    `static String` | `PARAM_CONTENT_DATA` |
    `static String` | `PARAM_CONTENT_TYPE` |
    `static String` | `PARAM_CONTENT_TYPE_CHARSET` |
    `static String` | `PARAM_COOKIE` |
    `static String` | `PARAM_COOKIE_PATH` |
    `static String` | `PARAM_HEADERS` |
    `static String` | `PARAM_PASSWORD` |
    `static String` | `PARAM_READ_TIMEOUT` |
    `static String` | `PARAM_RESULT` |
    `static String` | `PARAM_STATUS` |
    `static String` | `PARAM_STATUS_MSG` |
    `static String` | `PARAM_USERNAME` |
    `protected static String` | `USE_SYSTEM_PROPERTIES` |

    - ### Fields inherited from class org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler

      `handlingProcessId, handlingStrategy, logThrownException, retries`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RESTWorkItemHandler()` | Used when no authentication is required
    `RESTWorkItemHandler​(boolean doCacheClient)` | Used when no authentication is required
    `RESTWorkItemHandler​(boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader, boolean doCacheClient)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)` | Used when no authentication is required
    `RESTWorkItemHandler​(ClassLoader classLoader, String handlingProcessId, String handlingStrategy)` | Used when no authentication is required
    `RESTWorkItemHandler​(String username, String password)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, boolean doCacheClient)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader, boolean doCacheClient)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, ClassLoader classLoader, String handlingProcessId, String handlingStrategy)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl, boolean doCacheClient)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl, ClassLoader classLoader)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Dedicated constructor when FORM BASED authentication method shall be used
    `RESTWorkItemHandler​(String handlingProcessId, String handlingStrategy, String username, String password)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String handlingProcessId, String handlingStrategy, String username, String password, boolean doCacheClient)` | Dedicated constructor when BASIC authentication method shall be used
    `RESTWorkItemHandler​(String handlingProcessId, String handlingStrategy, String username, String password, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)` | Dedicated constructor when BASIC authentication method shall be used

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `abortWorkItem​(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)` |
    `protected void` | `addAcceptHeader​(org.apache.http.client.methods.HttpRequestBase theMethod, String value)` |
    `protected void` | `addAcceptHeader​(org.apache.http.client.methods.RequestBuilder builder, String value)` |
    `protected org.apache.http.impl.client.BasicCookieStore` | `addCookie​(String url, String cookie, String cookiePath)` |
    `protected void` | `addCustomHeaders​(String headers, BiConsumer<String,​String> consumer)` |
    `void` | `close()` |
    `protected void` | `close​(org.apache.http.client.HttpClient httpClient, Object httpMethod)` |
    `protected Object` | `configureRequest​(String method, String urlStr, Map<String,​Object> params, String acceptHeaderValue, String acceptCharset, String httpHeaders)` |
    `protected org.apache.http.HttpResponse` | `doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient, Object method, Map<String,​Object> params, RESTWorkItemHandler.AuthenticationType authType)` |
    `protected org.apache.http.HttpResponse` | `doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient, org.apache.http.client.methods.HttpRequestBase httpMethod, Map<String,​Object> params, RESTWorkItemHandler.AuthenticationType type)` |
    `protected org.apache.http.HttpResponse` | `doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient, org.apache.http.client.methods.RequestBuilder requestBuilder, Map<String,​Object> params, RESTWorkItemHandler.AuthenticationType type)` | This method does the actual request, including the setup for authorization.
    `void` | `executeWorkItem​(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)` |
    `String` | `getAuthUrl()` |
    `protected String` | `getContentTypeAndCharset​(Map<String,​Object> params)` |
    `boolean` | `getDoCacheClient()` |
    `protected org.apache.http.client.HttpClient` | `getHttpClient​(Integer readTimeout, Integer connectTimeout, String url, String cookie, String cookiePath)` |
    `protected org.apache.http.impl.client.CloseableHttpClient` | `getNewPooledHttpClient​(Integer readTimeout, Integer connectTimeout)` |
    `protected Integer` | `getParamAsInt​(Object param)` |
    `protected void` | `postProcessResult​(String result, String resultClass, String contentType, Map<String,​Object> results)` |
    `protected void` | `setBody​(org.apache.http.client.methods.HttpRequestBase theMethod, Map<String,​Object> params)` |
    `protected void` | `setBody​(org.apache.http.client.methods.RequestBuilder builder, Map<String,​Object> params)` |
    `protected void` | `setCharset​(org.apache.http.client.methods.HttpRequestBase theMethod, String charset)` |
    `protected void` | `setCharset​(org.apache.http.client.methods.RequestBuilder builder, String charset)` |
    `protected String` | `transformRequest​(Object data, String contentType)` |
    `protected Object` | `transformResult​(Class<?> clazz, String contentType, String content)` |

    - ### Methods inherited from class org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler

      `findNodeInstance, handleException, handleException, setLogThrownException`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### USE_SYSTEM_PROPERTIES

          protected static final String USE_SYSTEM_PROPERTIES

      See Also:
        Constant Field Values

    - #### PARAM_AUTH_TYPE

          public static final String PARAM_AUTH_TYPE

      See Also:
        Constant Field Values

    - #### PARAM_CONNECT_TIMEOUT

          public static final String PARAM_CONNECT_TIMEOUT

      See Also:
        Constant Field Values

    - #### PARAM_READ_TIMEOUT

          public static final String PARAM_READ_TIMEOUT

      See Also:
        Constant Field Values

    - #### PARAM_CONTENT_TYPE

          public static final String PARAM_CONTENT_TYPE

      See Also:
        Constant Field Values

    - #### PARAM_CONTENT_TYPE_CHARSET

          public static final String PARAM_CONTENT_TYPE_CHARSET

      See Also:
        Constant Field Values

    - #### PARAM_HEADERS

          public static final String PARAM_HEADERS

      See Also:
        Constant Field Values

    - #### PARAM_CONTENT

          public static final String PARAM_CONTENT

      See Also:
        Constant Field Values

    - #### PARAM_CONTENT_DATA

          public static final String PARAM_CONTENT_DATA

      See Also:
        Constant Field Values

    - #### PARAM_USERNAME

          public static final String PARAM_USERNAME

      See Also:
        Constant Field Values

    - #### PARAM_PASSWORD

          public static final String PARAM_PASSWORD

      See Also:
        Constant Field Values

    - #### PARAM_AUTHURL

          public static final String PARAM_AUTHURL

      See Also:
        Constant Field Values

    - #### PARAM_RESULT

          public static final String PARAM_RESULT

      See Also:
        Constant Field Values

    - #### PARAM_STATUS

          public static final String PARAM_STATUS

      See Also:
        Constant Field Values

    - #### PARAM_STATUS_MSG

          public static final String PARAM_STATUS_MSG

      See Also:
        Constant Field Values

    - #### PARAM_COOKIE

          public static final String PARAM_COOKIE

      See Also:
        Constant Field Values

    - #### PARAM_COOKIE_PATH

          public static final String PARAM_COOKIE_PATH

      See Also:
        Constant Field Values

    - #### connectionManager

          protected static org.apache.http.impl.conn.PoolingHttpClientConnectionManager connectionManager

    - #### cachedClient

          protected static org.apache.http.impl.client.CloseableHttpClient cachedClient

    - #### HTTP_CLIENT_API_43

          protected static boolean HTTP_CLIENT_API_43

  - ### Constructor Detail

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler()

      Used when no authentication is required

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(boolean doCacheClient)

      Used when no authentication is required
      Parameters:
        `doCacheClient` - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Used when no authentication is required
      Parameters:
        `doCacheClient` - - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     boolean doCacheClient)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl,
                                     boolean doCacheClient)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader,
                                     boolean doCacheClient)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader,
                                     boolean doCacheClient)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl,
                                     ClassLoader classLoader)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used
        `classLoader` - - given classloader

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl,
                                     ClassLoader classLoader,
                                     boolean doCacheClient)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     String authUrl,
                                     ClassLoader classLoader,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Dedicated constructor when FORM BASED authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `authUrl` - - authentication url to be used
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String handlingProcessId,
                                     String handlingStrategy,
                                     String username,
                                     String password)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String handlingProcessId,
                                     String handlingStrategy,
                                     String username,
                                     String password,
                                     boolean doCacheClient)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `doCacheClient` - - true/false setting for client cache

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String handlingProcessId,
                                     String handlingStrategy,
                                     String username,
                                     String password,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader,
                                     boolean doCacheClient,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(ClassLoader classLoader,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Used when no authentication is required
      Parameters:
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader,
                                     boolean doCacheClient,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

    - #### RESTWorkItemHandler

          public RESTWorkItemHandler​(String username,
                                     String password,
                                     ClassLoader classLoader,
                                     boolean doCacheClient,
                                     int totalPoolConnections,
                                     int maxPoolConnectionsPerRoute,
                                     String handlingProcessId,
                                     String handlingStrategy)

      Dedicated constructor when BASIC authentication method shall be used
      Parameters:
        `username` - - user name to be used for authentication
        `password` - - password to be used for authentication
        `classLoader` - - given classloader
        `doCacheClient` - - true/false setting for client cache
        `totalPoolConnections` - - max pool connections if caching client is used
        `maxPoolConnectionsPerRoute` - - max pool connections per route if caching client is used
        `handlingProcessId` - - process id to handle exception
        `handlingStrategy` - - strategy to be applied after handling exception process is completed

  - ### Method Detail

    - #### getAuthUrl

          public String getAuthUrl()

    - #### getDoCacheClient

          public boolean getDoCacheClient()

    - #### executeWorkItem

          public void executeWorkItem​(org.kie.api.runtime.process.WorkItem workItem,
                                      org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `executeWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

    - #### getParamAsInt

          protected Integer getParamAsInt​(Object param)

    - #### setCharset

          protected void setCharset​(org.apache.http.client.methods.RequestBuilder builder,
                                    String charset)

    - #### addAcceptHeader

          protected void addAcceptHeader​(org.apache.http.client.methods.RequestBuilder builder,
                                         String value)

    - #### setCharset

          protected void setCharset​(org.apache.http.client.methods.HttpRequestBase theMethod,
                                    String charset)

    - #### addAcceptHeader

          protected void addAcceptHeader​(org.apache.http.client.methods.HttpRequestBase theMethod,
                                         String value)

    - #### addCustomHeaders

          protected void addCustomHeaders​(String headers,
                                          BiConsumer<String,​String> consumer)

    - #### setBody

          protected void setBody​(org.apache.http.client.methods.RequestBuilder builder,
                                 Map<String,​Object> params)

    - #### setBody

          protected void setBody​(org.apache.http.client.methods.HttpRequestBase theMethod,
                                 Map<String,​Object> params)

    - #### postProcessResult

          protected void postProcessResult​(String result,
                                           String resultClass,
                                           String contentType,
                                           Map<String,​Object> results)

    - #### transformRequest

          protected String transformRequest​(Object data,
                                            String contentType)

    - #### transformResult

          protected Object transformResult​(Class<?> clazz,
                                           String contentType,
                                           String content)
                                    throws Exception

      Throws:
        `Exception`

    - #### doRequestWithAuthorization

          protected org.apache.http.HttpResponse doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient,
                                                                            Object method,
                                                                            Map<String,​Object> params,
                                                                            RESTWorkItemHandler.AuthenticationType authType)

    - #### doRequestWithAuthorization

          protected org.apache.http.HttpResponse doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient,
                                                                            org.apache.http.client.methods.RequestBuilder requestBuilder,
                                                                            Map<String,​Object> params,
                                                                            RESTWorkItemHandler.AuthenticationType type)

      This method does the actual request, including the setup for authorization. It is not responsible for cleaning up after the last request that it does. It is responsible for cleaning up after all previous request, such as for form-based authentication, that happen.
      Parameters:
        `httpclient` - The `HttpClient` instance
        `requestBuilder` - The `RequestBuilder` instance
        `params` - The parameters that may be needed for authentication
      Returns:
        A `HttpResponse` instance from which we can extract the content

    - #### doRequestWithAuthorization

          protected org.apache.http.HttpResponse doRequestWithAuthorization​(org.apache.http.client.HttpClient httpclient,
                                                                            org.apache.http.client.methods.HttpRequestBase httpMethod,
                                                                            Map<String,​Object> params,
                                                                            RESTWorkItemHandler.AuthenticationType type)

    - #### abortWorkItem

          public void abortWorkItem​(org.kie.api.runtime.process.WorkItem workItem,
                                    org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `abortWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

    - #### getHttpClient

          protected org.apache.http.client.HttpClient getHttpClient​(Integer readTimeout,
                                                                    Integer connectTimeout,
                                                                    String url,
                                                                    String cookie,
                                                                    String cookiePath)

    - #### addCookie

          protected org.apache.http.impl.client.BasicCookieStore addCookie​(String url,
                                                                           String cookie,
                                                                           String cookiePath)

    - #### getNewPooledHttpClient

          protected org.apache.http.impl.client.CloseableHttpClient getNewPooledHttpClient​(Integer readTimeout,
                                                                                           Integer connectTimeout)

    - #### close

          protected void close​(org.apache.http.client.HttpClient httpClient,
                               Object httpMethod)
                        throws IOException

      Throws:
        `IOException`

    - #### configureRequest

          protected Object configureRequest​(String method,
                                            String urlStr,
                                            Map<String,​Object> params,
                                            String acceptHeaderValue,
                                            String acceptCharset,
                                            String httpHeaders)

    - #### getContentTypeAndCharset

          protected String getContentTypeAndCharset​(Map<String,​Object> params)

    - #### close

          public void close()

      Specified by:
        `close` in interface `org.kie.internal.runtime.Cacheable`