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.74.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 org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler implements org.kie.internal.runtime.CacheableWorkItemHandler 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
- 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 classRESTWorkItemHandler.AuthenticationType
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.http.impl.client.CloseableHttpClientcachedClientprotected static org.apache.http.impl.conn.PoolingHttpClientConnectionManagerconnectionManagerprotected static booleanHTTP_CLIENT_API_43static StringPARAM_AUTH_TYPEstatic StringPARAM_AUTHURLstatic StringPARAM_CONNECT_TIMEOUTstatic StringPARAM_CONTENTstatic StringPARAM_CONTENT_DATAstatic StringPARAM_CONTENT_TYPEstatic StringPARAM_CONTENT_TYPE_CHARSETstatic StringPARAM_COOKIEstatic StringPARAM_COOKIE_PATHstatic StringPARAM_HEADERSstatic StringPARAM_PASSWORDstatic StringPARAM_READ_TIMEOUTstatic StringPARAM_RESULTstatic StringPARAM_STATUSstatic StringPARAM_STATUS_MSGstatic StringPARAM_USERNAMEprotected static StringUSE_SYSTEM_PROPERTIES
-
Constructor Summary
Constructors Constructor Description RESTWorkItemHandler()Used when no authentication is requiredRESTWorkItemHandler(boolean doCacheClient)Used when no authentication is requiredRESTWorkItemHandler(boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)Used when no authentication is requiredRESTWorkItemHandler(ClassLoader classLoader, String handlingProcessId, String handlingStrategy)Used when no authentication is requiredRESTWorkItemHandler(String username, String password)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, boolean doCacheClient)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, ClassLoader classLoader, String handlingProcessId, String handlingStrategy)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl, boolean doCacheClient)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)Dedicated constructor when FORM BASED authentication method shall be usedRESTWorkItemHandler(String handlingProcessId, String handlingStrategy, String username, String password)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(String handlingProcessId, String handlingStrategy, String username, String password, boolean doCacheClient)Dedicated constructor when BASIC authentication method shall be usedRESTWorkItemHandler(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 voidabortWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)protected voidaddAcceptHeader(org.apache.http.client.methods.HttpRequestBase theMethod, String value)protected voidaddAcceptHeader(org.apache.http.client.methods.RequestBuilder builder, String value)protected org.apache.http.impl.client.BasicCookieStoreaddCookie(String url, String cookie, String cookiePath)protected voidaddCustomHeaders(String headers, BiConsumer<String,String> consumer)voidclose()protected voidclose(org.apache.http.client.HttpClient httpClient, Object httpMethod)protected ObjectconfigureRequest(String method, String urlStr, Map<String,Object> params, String acceptHeaderValue, String acceptCharset, String httpHeaders)protected org.apache.http.HttpResponsedoRequestWithAuthorization(org.apache.http.client.HttpClient httpclient, Object method, Map<String,Object> params, RESTWorkItemHandler.AuthenticationType authType)protected org.apache.http.HttpResponsedoRequestWithAuthorization(org.apache.http.client.HttpClient httpclient, org.apache.http.client.methods.HttpRequestBase httpMethod, Map<String,Object> params, RESTWorkItemHandler.AuthenticationType type)protected org.apache.http.HttpResponsedoRequestWithAuthorization(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.voidexecuteWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)StringgetAuthUrl()protected StringgetContentTypeAndCharset(Map<String,Object> params)booleangetDoCacheClient()protected org.apache.http.client.HttpClientgetHttpClient(Integer readTimeout, Integer connectTimeout, String url, String cookie, String cookiePath)protected org.apache.http.impl.client.CloseableHttpClientgetNewPooledHttpClient(Integer readTimeout, Integer connectTimeout)protected IntegergetParamAsInt(Object param)protected voidpostProcessResult(String result, String resultClass, String contentType, Map<String,Object> results)protected voidsetBody(org.apache.http.client.methods.HttpRequestBase theMethod, Map<String,Object> params)protected voidsetBody(org.apache.http.client.methods.RequestBuilder builder, Map<String,Object> params)protected voidsetCharset(org.apache.http.client.methods.HttpRequestBase theMethod, String charset)protected voidsetCharset(org.apache.http.client.methods.RequestBuilder builder, String charset)protected StringtransformRequest(Object data, String contentType)protected ObjecttransformResult(Class<?> clazz, String contentType, String content)
-
-
-
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 cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 authenticationpassword- - 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 authenticationpassword- - password to be used for authenticationdoCacheClient- - 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 authenticationpassword- - password to be used for authenticationdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - authentication url to be useddoCacheClient- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - authentication url to be useddoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 classloaderdoCacheClient- - 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 classloaderdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - given classloaderdoCacheClient- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - given classloaderdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - authentication url to be usedclassLoader- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - authentication url to be usedclassLoader- - given classloaderdoCacheClient- - 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 authenticationpassword- - password to be used for authenticationauthUrl- - authentication url to be usedclassLoader- - given classloaderdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 exceptionhandlingStrategy- - strategy to be applied after handling exception process is completedusername- - user name to be used for authenticationpassword- - 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 exceptionhandlingStrategy- - strategy to be applied after handling exception process is completedusername- - user name to be used for authenticationpassword- - password to be used for authenticationdoCacheClient- - 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 exceptionhandlingStrategy- - strategy to be applied after handling exception process is completedusername- - user name to be used for authenticationpassword- - password to be used for authenticationdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - 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 classloaderhandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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 classloaderdoCacheClient- - true/false setting for client cachehandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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 classloaderdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - max pool connections per route if caching client is usedhandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - given classloaderhandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - given classloaderdoCacheClient- - true/false setting for client cachehandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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 authenticationpassword- - password to be used for authenticationclassLoader- - given classloaderdoCacheClient- - true/false setting for client cachetotalPoolConnections- - max pool connections if caching client is usedmaxPoolConnectionsPerRoute- - max pool connections per route if caching client is usedhandlingProcessId- - process id to handle exceptionhandlingStrategy- - 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:
executeWorkItemin interfaceorg.kie.api.runtime.process.WorkItemHandler
-
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)
-
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- TheHttpClientinstancerequestBuilder- TheRequestBuilderinstanceparams- The parameters that may be needed for authentication- Returns:
- A
HttpResponseinstance 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:
abortWorkItemin interfaceorg.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)
-
close
public void close()
- Specified by:
closein interfaceorg.kie.internal.runtime.Cacheable
-
-