@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="Rest.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")},results=@WidResult(name="Result",runtimeType="java.lang.Object"),mavenDepends=@WidMavenDepends(group="org.jbpm",artifact="jbpm-workitems-rest",version="7.51.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
| Modifier and Type | Class and Description |
|---|---|
static class |
RESTWorkItemHandler.AuthenticationType |
| Modifier and Type | Field and 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_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 |
handlingProcessId, handlingStrategy, logThrownException, retries| Constructor and 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
|
| Modifier and Type | Method and 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 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,
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,
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.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) |
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) |
findNodeInstance, handleException, handleException, setLogThrownExceptionprotected static final String USE_SYSTEM_PROPERTIES
public static final String PARAM_AUTH_TYPE
public static final String PARAM_CONNECT_TIMEOUT
public static final String PARAM_READ_TIMEOUT
public static final String PARAM_CONTENT_TYPE
public static final String PARAM_CONTENT_TYPE_CHARSET
public static final String PARAM_HEADERS
public static final String PARAM_CONTENT
public static final String PARAM_CONTENT_DATA
public static final String PARAM_USERNAME
public static final String PARAM_PASSWORD
public static final String PARAM_AUTHURL
public static final String PARAM_RESULT
public static final String PARAM_STATUS
public static final String PARAM_STATUS_MSG
protected static org.apache.http.impl.conn.PoolingHttpClientConnectionManager connectionManager
protected static org.apache.http.impl.client.CloseableHttpClient cachedClient
protected static boolean HTTP_CLIENT_API_43
public RESTWorkItemHandler()
public RESTWorkItemHandler(boolean doCacheClient)
doCacheClient - true/false setting for client cachepublic RESTWorkItemHandler(boolean doCacheClient,
int totalPoolConnections,
int maxPoolConnectionsPerRoute)
doCacheClient - - - true/false setting for client cachetotalPoolConnections - - max pool connections if caching client is usedmaxPoolConnectionsPerRoute - - max pool connections per route if caching client is usedpublic RESTWorkItemHandler(String username, String password)
username - - user name to be used for authenticationpassword - - password to be used for authenticationpublic RESTWorkItemHandler(String username, String password, boolean doCacheClient)
username - - user name to be used for authenticationpassword - - password to be used for authenticationdoCacheClient - - true/false setting for client cachepublic RESTWorkItemHandler(String username, String password, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(String username, String password, String authUrl)
username - - user name to be used for authenticationpassword - - password to be used for authenticationauthUrl - - authentication url to be usedpublic RESTWorkItemHandler(String username, String password, String authUrl, boolean doCacheClient)
username - - user name to be used for authenticationpassword - - password to be used for authenticationauthUrl - - authentication url to be useddoCacheClient - - true/false setting for client cachepublic RESTWorkItemHandler(String username, String password, String authUrl, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(ClassLoader classLoader)
classLoader - - given classloaderpublic RESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient)
classLoader - - given classloaderdoCacheClient - - true/false setting for client cachepublic RESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader)
username - - user name to be used for authenticationpassword - - password to be used for authenticationclassLoader - - given classloaderpublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient)
username - - user name to be used for authenticationpassword - - password to be used for authenticationclassLoader - - given classloaderdoCacheClient - - true/false setting for client cachepublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader)
username - - user name to be used for authenticationpassword - - password to be used for authenticationauthUrl - - authentication url to be usedclassLoader - - given classloaderpublic RESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient)
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 cachepublic RESTWorkItemHandler(String username, String password, String authUrl, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(String handlingProcessId, String handlingStrategy, String username, String password)
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 authenticationpublic RESTWorkItemHandler(String handlingProcessId, String handlingStrategy, String username, String password, boolean doCacheClient)
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 cachepublic RESTWorkItemHandler(String handlingProcessId, String handlingStrategy, String username, String password, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute)
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 usedpublic RESTWorkItemHandler(ClassLoader classLoader, String handlingProcessId, String handlingStrategy)
classLoader - - given classloaderhandlingProcessId - - process id to handle exceptionhandlingStrategy - - strategy to be applied after handling exception process is completedpublic RESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)
classLoader - - given classloaderdoCacheClient - - true/false setting for client cachehandlingProcessId - - process id to handle exceptionhandlingStrategy - - strategy to be applied after handling exception process is completedpublic RESTWorkItemHandler(ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)
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 completedpublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader, String handlingProcessId, String handlingStrategy)
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 completedpublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, String handlingProcessId, String handlingStrategy)
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 completedpublic RESTWorkItemHandler(String username, String password, ClassLoader classLoader, boolean doCacheClient, int totalPoolConnections, int maxPoolConnectionsPerRoute, String handlingProcessId, String handlingStrategy)
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 completedpublic String getAuthUrl()
public boolean getDoCacheClient()
public void executeWorkItem(org.kie.api.runtime.process.WorkItem workItem,
org.kie.api.runtime.process.WorkItemManager manager)
executeWorkItem in interface org.kie.api.runtime.process.WorkItemHandlerprotected void setCharset(org.apache.http.client.methods.RequestBuilder builder,
String charset)
protected void addAcceptHeader(org.apache.http.client.methods.RequestBuilder builder,
String value)
protected void setCharset(org.apache.http.client.methods.HttpRequestBase theMethod,
String charset)
protected void addAcceptHeader(org.apache.http.client.methods.HttpRequestBase theMethod,
String value)
protected void addCustomHeaders(String headers, BiConsumer<String,String> consumer)
protected void setBody(org.apache.http.client.methods.RequestBuilder builder,
Map<String,Object> params)
protected void setBody(org.apache.http.client.methods.HttpRequestBase theMethod,
Map<String,Object> params)
protected void postProcessResult(String result, String resultClass, String contentType, Map<String,Object> results)
protected Object transformResult(Class<?> clazz, String contentType, String content) throws Exception
Exceptionprotected 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.RequestBuilder requestBuilder,
Map<String,Object> params,
RESTWorkItemHandler.AuthenticationType type)
httpclient - The HttpClient instancerequestBuilder - The RequestBuilder instanceparams - The parameters that may be needed for authenticationHttpResponse instance from which we can extract the contentprotected 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)
public void abortWorkItem(org.kie.api.runtime.process.WorkItem workItem,
org.kie.api.runtime.process.WorkItemManager manager)
abortWorkItem in interface org.kie.api.runtime.process.WorkItemHandlerprotected org.apache.http.client.HttpClient getHttpClient(Integer readTimeout, Integer connectTimeout)
protected org.apache.http.impl.client.CloseableHttpClient getNewPooledHttpClient(Integer readTimeout, Integer connectTimeout)
protected void close(org.apache.http.client.HttpClient httpClient,
Object httpMethod)
throws IOException
IOExceptionprotected Object configureRequest(String method, String urlStr, Map<String,Object> params, String acceptHeaderValue, String acceptCharset, String httpHeaders)
public void close()
close in interface org.kie.internal.runtime.CacheableCopyright © 2001–2021 jBPM dev team. All rights reserved.