Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.2.0.CR2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbpm.process.workitem.rest
Class RESTWorkItemHandler

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

All Implemented Interfaces:
  WorkItemHandler

    public class RESTWorkItemHandler

extends AbstractLogOrThrowWorkItemHandler

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
- Content - 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)

Nested Class Summary
`static class` | `RESTWorkItemHandler.AuthenticationType`

Field Summary

Fields inherited from class org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler
`logThrownException`

Constructor Summary
`RESTWorkItemHandler()` 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, String authUrl)` Dedicated constructor when FORM BASED authentication method shall be used

Method Summary
`void` | `abortWorkItem(WorkItem workItem, WorkItemManager manager)` The given work item should be aborted.
`protected void` | `doAuthorization(org.apache.commons.httpclient.HttpClient httpclient, org.apache.commons.httpclient.HttpMethod method, Map<String,Object> params)`
`void` | `executeWorkItem(WorkItem workItem, WorkItemManager manager)` The given work item should be executed.
`String` | `getAuthUrl()`
`protected Integer` | `getParamAsInt(Object param)`
`protected void` | `postProcessResult(String result, Map<String,Object> results)`
`protected void` | `setBody(org.apache.commons.httpclient.HttpMethod theMethod, Map<String,Object> params)`

Methods inherited from class org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler
`handleException, handleException, setLogThrownException`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RESTWorkItemHandler

    public RESTWorkItemHandler()

  Used when no authentication is required

### 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,
                               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` -

Method Detail

### getAuthUrl

    public String getAuthUrl()

### executeWorkItem

    public void executeWorkItem(WorkItem workItem,
                                WorkItemManager manager)

  Description copied from interface: `WorkItemHandler`
  The given work item should be executed.

  Parameters:
    `workItem` - the work item that should be executed
    `manager` - the manager that requested the work item to be executed

### getParamAsInt

    protected Integer getParamAsInt(Object param)

### setBody

    protected void setBody(org.apache.commons.httpclient.HttpMethod theMethod,
                           Map<String,Object> params)

### postProcessResult

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

### doAuthorization

    protected void doAuthorization(org.apache.commons.httpclient.HttpClient httpclient,
                                   org.apache.commons.httpclient.HttpMethod method,
                                   Map<String,Object> params)

### abortWorkItem

    public void abortWorkItem(WorkItem workItem,
                              WorkItemManager manager)

  Description copied from interface: `WorkItemHandler`
  The given work item should be aborted.

  Parameters:
    `workItem` - the work item that should be aborted
    `manager` - the manager that requested the work item to be aborted

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.2.0.CR2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.