Example usage for org.apache.http.util EntityUtils consumeQuietly

List of usage examples for org.apache.http.util EntityUtils consumeQuietly

Introduction

In this page you can find the example usage for org.apache.http.util EntityUtils consumeQuietly.

Prototype

public static void consumeQuietly(HttpEntity httpEntity) 

Source Link

Usage

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

@SuppressWarnings("unchecked")
public List<SearchResultEntry> search(int tenantId, String username, String tableName, String query, int start,
        int count, boolean securityEnabled) throws AnalyticsServiceException {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.SEARCH_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION, AnalyticsAPIConstants.SEARCH_OPERATION)
            .addParameter(AnalyticsAPIConstants.TABLE_NAME_PARAM, tableName)
            .addParameter(AnalyticsAPIConstants.QUERY, query)
            .addParameter(AnalyticsAPIConstants.START_PARAM, String.valueOf(start))
            .addParameter(AnalyticsAPIConstants.COUNT_PARAM, String.valueOf(count))
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*from w  ww.java 2s .  c  o m*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpGet getMethod = new HttpGet(builder.build().toString());
        getMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        HttpResponse httpResponse = httpClient.execute(getMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to search the table - " + tableName
                    + " for tenant id : " + tenantId + " with query : " + query + ". " + response);
        } else {
            Object searchResultObj = GenericUtils.deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (searchResultObj != null && searchResultObj instanceof List) {
                return (List<SearchResultEntry>) searchResultObj;
            } else {
                throw new AnalyticsServiceException(getUnexpectedResponseReturnedErrorMsg("searching the table",
                        tableName, "List of Search Result Entry objects", searchResultObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceAuthenticationException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceAuthenticationException(
                "Error while connecting to the remote service. " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

public AnalyticsDataResponse getRecordGroup(int tenantId, String username, String tableName,
        int numPartitionsHint, List<String> columns, long timeFrom, long timeTo, int recordsFrom,
        int recordsCount, boolean securityEnabled) throws AnalyticsServiceException {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.ANALYTIC_RECORD_READ_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION,
                    AnalyticsAPIConstants.GET_RANGE_RECORD_GROUP_OPERATION)
            .addParameter(AnalyticsAPIConstants.TABLE_NAME_PARAM, tableName)
            .addParameter(AnalyticsAPIConstants.PARTITIONER_NO_PARAM, String.valueOf(numPartitionsHint))
            .addParameter(AnalyticsAPIConstants.COLUMNS_PARAM, new Gson().toJson(columns))
            .addParameter(AnalyticsAPIConstants.TIME_FROM_PARAM, String.valueOf(timeFrom))
            .addParameter(AnalyticsAPIConstants.TIME_TO_PARAM, String.valueOf(timeTo))
            .addParameter(AnalyticsAPIConstants.RECORD_FROM_PARAM, String.valueOf(recordsFrom))
            .addParameter(AnalyticsAPIConstants.COUNT_PARAM, String.valueOf(recordsCount))
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*w w w. ja  va  2 s. c om*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpGet getMethod = new HttpGet(builder.build().toString());
        getMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        HttpResponse httpResponse = httpClient.execute(getMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to destroy the process . " + response);
        } else {
            Object analyticsDataResponseObj = GenericUtils
                    .deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (analyticsDataResponseObj != null && analyticsDataResponseObj instanceof AnalyticsDataResponse) {
                AnalyticsDataResponse analyticsDataResponse = (AnalyticsDataResponse) analyticsDataResponseObj;
                if (analyticsDataResponse.getRecordGroups() instanceof RemoteRecordGroup[]) {
                    return analyticsDataResponse;
                } else {
                    throw new AnalyticsServiceAuthenticationException(getUnexpectedResponseReturnedErrorMsg(
                            "getting " + "the record group", tableName,
                            "Analytics Data Response object consist of" + " array of remote record group",
                            analyticsDataResponseObj));
                }
            } else {
                throw new AnalyticsServiceAuthenticationException(
                        getUnexpectedResponseReturnedErrorMsg("getting " + "the record group", tableName,
                                "Analytics Data Response object", analyticsDataResponseObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceAuthenticationException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceAuthenticationException(
                "Error while connecting to the remote service. " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

public AnalyticsDataResponse getWithKeyValues(int tenantId, String username, String tableName,
        int numPartitionsHint, List<String> columns, List<Map<String, Object>> valuesBatch,
        boolean securityEnabled) throws AnalyticsServiceException {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.ANALYTIC_RECORD_READ_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION,
                    AnalyticsAPIConstants.GET_RECORDS_WITH_KEY_VALUES_OPERATION)
            .addParameter(AnalyticsAPIConstants.TABLE_NAME_PARAM, tableName)
            .addParameter(AnalyticsAPIConstants.PARTITIONER_NO_PARAM, String.valueOf(numPartitionsHint))
            .addParameter(AnalyticsAPIConstants.COLUMNS_PARAM, new Gson().toJson(columns))
            .addParameter(AnalyticsAPIConstants.KEY_VALUE_PARAM, new Gson().toJson(valuesBatch))
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {//w  w  w .ja va 2  s.c  o m
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpGet getMethod = new HttpGet(builder.build().toString());
        getMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        HttpResponse httpResponse = httpClient.execute(getMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to get with key values . " + response);
        } else {
            Object analyticsDataResponseObj = GenericUtils
                    .deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (analyticsDataResponseObj != null && analyticsDataResponseObj instanceof AnalyticsDataResponse) {
                AnalyticsDataResponse analyticsDataResponse = (AnalyticsDataResponse) analyticsDataResponseObj;
                if (analyticsDataResponse.getRecordGroups() instanceof RemoteRecordGroup[]) {
                    return analyticsDataResponse;
                } else {
                    throw new AnalyticsServiceAuthenticationException(getUnexpectedResponseReturnedErrorMsg(
                            "getting " + "with key values", tableName,
                            "Analytics Data Response object consist of" + " array of remote record group",
                            analyticsDataResponseObj));
                }
            } else {
                throw new AnalyticsServiceAuthenticationException(
                        getUnexpectedResponseReturnedErrorMsg("getting " + "with key value", tableName,
                                "Analytics Data Response object", analyticsDataResponseObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceAuthenticationException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceAuthenticationException(
                "Error while connecting to the remote service. " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

@SuppressWarnings("unchecked")
public List<String> listRecordStoreNames() {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.ANALYTIC_RECORD_STORE_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION, AnalyticsAPIConstants.LIST_RECORD_STORES_OPERATION);
    try {//w  ww . jav  a2  s.  c o  m
        HttpGet getMethod = new HttpGet(builder.build().toString());
        getMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        HttpResponse httpResponse = httpClient.execute(getMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to list the record stores." + response);
        } else {
            Object listOfRecordStores = GenericUtils.deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (listOfRecordStores != null && listOfRecordStores instanceof List) {
                return (List<String>) listOfRecordStores;
            } else {
                throw new AnalyticsServiceException(getUnexpectedResponseReturnedErrorMsg(
                        "getting list of record stores", null, "list of record store", listOfRecordStores));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceAuthenticationException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceAuthenticationException(
                "Error while connecting to the remote service. " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

public AnalyticsDataResponse getRecordGroup(int tenantId, String username, String tableName,
        int numPartitionsHint, List<String> columns, List<String> ids, boolean securityEnabled)
        throws AnalyticsServiceException {
    URIBuilder builder = new URIBuilder();
    Gson gson = new Gson();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.ANALYTIC_RECORD_READ_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION, AnalyticsAPIConstants.GET_IDS_RECORD_GROUP_OPERATION)
            .addParameter(AnalyticsAPIConstants.TABLE_NAME_PARAM, tableName)
            .addParameter(AnalyticsAPIConstants.PARTITIONER_NO_PARAM, String.valueOf(numPartitionsHint))
            .addParameter(AnalyticsAPIConstants.COLUMNS_PARAM, gson.toJson(columns))
            .addParameter(AnalyticsAPIConstants.RECORD_IDS_PARAM, gson.toJson(ids))
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*from  w w  w.j  ava 2 s. c om*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpGet getMethod = new HttpGet(builder.build().toString());
        getMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        HttpResponse httpResponse = httpClient.execute(getMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to destroy the process . " + response);
        } else {
            Object analyticsDataResponseObj = GenericUtils
                    .deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (analyticsDataResponseObj != null && analyticsDataResponseObj instanceof AnalyticsDataResponse) {
                AnalyticsDataResponse analyticsDataResponse = (AnalyticsDataResponse) analyticsDataResponseObj;
                if (analyticsDataResponse.getRecordGroups() instanceof RemoteRecordGroup[]) {
                    return analyticsDataResponse;
                } else {
                    throw new AnalyticsServiceAuthenticationException(getUnexpectedResponseReturnedErrorMsg(
                            "getting " + "the record group", tableName,
                            "Analytics Data Response object consist of" + " array of remote record group",
                            analyticsDataResponseObj));
                }
            } else {
                throw new AnalyticsServiceAuthenticationException(
                        getUnexpectedResponseReturnedErrorMsg("getting " + "the record group", tableName,
                                "Analytics Data Response object", analyticsDataResponseObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceAuthenticationException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceAuthenticationException(
                "Error while connecting to the remote service. " + e.getMessage(), e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

@SuppressWarnings("unchecked")
public List<SearchResultEntry> drillDownSearch(int tenantId, String username,
        AnalyticsDrillDownRequest drillDownRequest, boolean securityEnabled) {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.SEARCH_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION, AnalyticsAPIConstants.DRILL_DOWN_SEARCH_OPERATION)
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*from  w  w w  .j  a  v a  2  s .  c o m*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpPost postMethod = new HttpPost(builder.build().toString());
        postMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        postMethod.setEntity(new ByteArrayEntity(GenericUtils.serializeObject(drillDownRequest)));
        HttpResponse httpResponse = httpClient.execute(postMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to process the DrillDown Request. " + response);
        } else {
            Object searchResultListObj = GenericUtils.deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (searchResultListObj != null && searchResultListObj instanceof List) {
                return (List<SearchResultEntry>) searchResultListObj;
            } else {
                throw new AnalyticsServiceException(getUnexpectedResponseReturnedErrorMsg(
                        "preforming drill down search", drillDownRequest.getTableName(),
                        "list of search result entry", searchResultListObj));
            }
        }

    } catch (URISyntaxException e) {
        throw new AnalyticsServiceException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceException("Error while connecting to the remote service. " + e.getMessage(),
                e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

public int drillDownSearchCount(int tenantId, String username, AnalyticsDrillDownRequest drillDownRequest,
        boolean securityEnabled) {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.SEARCH_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION,
                    AnalyticsAPIConstants.DRILL_DOWN_SEARCH_COUNT_OPERATION)
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*from   w w  w  .  ja  v a2 s. com*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpPost postMethod = new HttpPost(builder.build().toString());
        postMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        postMethod.setEntity(new ByteArrayEntity(GenericUtils.serializeObject(drillDownRequest)));
        HttpResponse httpResponse = httpClient.execute(postMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to process the drillDown request. " + response);
        } else {
            Object searchCountObj = GenericUtils.deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (searchCountObj != null && searchCountObj instanceof Integer) {
                return (Integer) searchCountObj;
            } else {
                throw new AnalyticsServiceException(
                        getUnexpectedResponseReturnedErrorMsg("preforming drill down search count",
                                drillDownRequest.getTableName(), "number of search result", searchCountObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceException("Error while connecting to the remote service. " + e.getMessage(),
                e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

public SubCategories drillDownCategories(int tenantId, String username,
        CategoryDrillDownRequest drillDownRequest, boolean securityEnabled) {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.SEARCH_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION,
                    AnalyticsAPIConstants.DRILL_DOWN_SEARCH_CATEGORY_OPERATION)
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {// w  w  w  . j  ava2s .  c om
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpPost postMethod = new HttpPost(builder.build().toString());
        postMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        postMethod.setEntity(new ByteArrayEntity(GenericUtils.serializeObject(drillDownRequest)));
        HttpResponse httpResponse = httpClient.execute(postMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to read the Category drilldown object. " + response);
        } else {
            Object drillDownCategoriesObj = GenericUtils
                    .deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (drillDownCategoriesObj != null && drillDownCategoriesObj instanceof SubCategories) {
                return (SubCategories) drillDownCategoriesObj;
            } else {
                throw new AnalyticsServiceException(getUnexpectedResponseReturnedErrorMsg(
                        "preforming drill down" + " search for categories", drillDownRequest.getTableName(),
                        "object of sub categories", drillDownCategoriesObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceException("Error while connecting to the remote service. " + e.getMessage(),
                e);
    }
}

From source file:org.wso2.carbon.analytics.api.internal.client.AnalyticsAPIHttpClient.java

@SuppressWarnings("unchecked")
public List<AnalyticsDrillDownRange> drillDownRangeCount(int tenantId, String username,
        AnalyticsDrillDownRequest drillDownRequest, boolean securityEnabled) {
    URIBuilder builder = new URIBuilder();
    builder.setScheme(protocol).setHost(hostname).setPort(port)
            .setPath(AnalyticsAPIConstants.SEARCH_PROCESSOR_SERVICE_URI)
            .addParameter(AnalyticsAPIConstants.OPERATION,
                    AnalyticsAPIConstants.DRILL_DOWN_SEARCH_RANGE_COUNT_OPERATION)
            .addParameter(AnalyticsAPIConstants.ENABLE_SECURITY_PARAM, String.valueOf(securityEnabled));
    if (!securityEnabled) {
        builder.addParameter(AnalyticsAPIConstants.TENANT_ID_PARAM, String.valueOf(tenantId));
    } else {/*  www .j  av  a2s.c o m*/
        builder.addParameter(AnalyticsAPIConstants.USERNAME_PARAM, username);
    }
    try {
        HttpPost postMethod = new HttpPost(builder.build().toString());
        postMethod.addHeader(AnalyticsAPIConstants.SESSION_ID, sessionId);
        postMethod.setEntity(new ByteArrayEntity(GenericUtils.serializeObject(drillDownRequest)));
        HttpResponse httpResponse = httpClient.execute(postMethod);
        if (httpResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
            String response = getResponseString(httpResponse);
            throw new AnalyticsServiceException("Unable to read the Analytics drilldown object. " + response);
        } else {
            Object listOfReangeObj = GenericUtils.deserializeObject(httpResponse.getEntity().getContent());
            EntityUtils.consumeQuietly(httpResponse.getEntity());
            if (listOfReangeObj != null && listOfReangeObj instanceof List) {
                return (List<AnalyticsDrillDownRange>) listOfReangeObj;
            } else {
                throw new AnalyticsServiceException(getUnexpectedResponseReturnedErrorMsg(
                        "preforming drill down range count", drillDownRequest.getTableName(),
                        "list of analytics drill down ranges", listOfReangeObj));
            }
        }
    } catch (URISyntaxException e) {
        throw new AnalyticsServiceException("Malformed URL provided. " + e.getMessage(), e);
    } catch (IOException e) {
        throw new AnalyticsServiceException("Error while connecting to the remote service. " + e.getMessage(),
                e);
    }
}