class RESTWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {

    public void executeWorkItem(WorkItem workItem,
                                WorkItemManager manager) {
        boolean handleException = false;
        // extract required parameters
        String urlStr = (String) workItem.getParameter("Url");
        String method = (String) workItem.getParameter("Method");
        String handleExceptionStr = (String) workItem.getParameter("HandleResponseErrors");
        String resultClass = (String) workItem.getParameter("ResultClass");
        String acceptHeader = (String) workItem.getParameter("AcceptHeader");
        String acceptCharset = (String) workItem.getParameter("AcceptCharset");
        String headers = (String) workItem.getParameter(PARAM_HEADERS);

        if (urlStr == null) {
            throw new IllegalArgumentException("Url is a required parameter");
        }
        if (method == null || method.trim().length() == 0) {
            method = "GET";
        }
        if (handleExceptionStr != null) {
            handleException = Boolean.parseBoolean(handleExceptionStr);
        }
        Map<String, Object> params = workItem.getParameters();

        // authentication type from parameters
        AuthenticationType authType = type;
        if (params.get(PARAM_AUTH_TYPE) != null) {
            authType = AuthenticationType.valueOf((String) params.get(PARAM_AUTH_TYPE));
        }

        // optional timeout config parameters, defaulted to 60 seconds
        Integer connectTimeout = getParamAsInt(params.get(PARAM_CONNECT_TIMEOUT));
        if (connectTimeout == null) {
            connectTimeout = 60000;
        }
        Integer readTimeout = getParamAsInt(params.get(PARAM_READ_TIMEOUT));
        if (readTimeout == null) {
            readTimeout = 60000;
        }
        if(headers == null) {
            headers = "";
        }

        HttpClient httpClient = getHttpClient(readTimeout,
                                              connectTimeout);

        Object methodObject = configureRequest(method,
                                               urlStr,
                                               params,
                                               acceptHeader,
                                               acceptCharset,
                                               headers);
        try {
            HttpResponse response = doRequestWithAuthorization(httpClient,
                                                               methodObject,
                                                               params,
                                                               authType);
            StatusLine statusLine = response.getStatusLine();
            int responseCode = statusLine.getStatusCode();
            Map<String, Object> results = new HashMap<String, Object>();
            HttpEntity respEntity = response.getEntity();
            String responseBody = null;
            String contentType = null;
            if (respEntity != null) {
                responseBody = EntityUtils.toString(respEntity, acceptCharset);

                if (respEntity.getContentType() != null) {
                    contentType = respEntity.getContentType().getValue();
                }
            }
            if (responseCode >= 200 && responseCode < 300) {
                postProcessResult(responseBody,
                                  resultClass,
                                  contentType,
                                  results);
                results.put(PARAM_STATUS_MSG,
                            "request to endpoint " + urlStr + " successfully completed " + statusLine.getReasonPhrase());
            } else {
                if (handleException) {
                    handleException(new RESTServiceException(responseCode,
                                                             responseBody,
                                                             urlStr));
                } else {
                    logger.warn("Unsuccessful response from REST server (status: {}, endpoint: {}, response: {}",
                                responseCode,
                                urlStr,
                                responseBody);
                    results.put(PARAM_STATUS_MSG,
                                "endpoint " + urlStr + " could not be reached: " + responseBody);
                }
            }
            results.put(PARAM_STATUS,
                        responseCode);

            // notify manager that work item has been completed
            manager.completeWorkItem(workItem.getId(),
                                     results);
        } catch (Exception e) {
            handleException(e);
        } finally {
            try {
                close(httpClient,
                      methodObject);
            } catch (Exception e) {
                handleException(e);
            }
        }
    }

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

}