Example usage for org.apache.commons.httpclient.params HttpParams setDoubleParameter

List of usage examples for org.apache.commons.httpclient.params HttpParams setDoubleParameter

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.params HttpParams setDoubleParameter.

Prototype

public abstract void setDoubleParameter(String paramString, double paramDouble);

Source Link

Usage

From source file:org.kuali.rice.ksb.messaging.HttpClientHelper.java

public static void setParameter(HttpParams params, String paramName, String paramValue) {
    Class<?> paramType = getParameterType(paramName);
    if (paramType.equals(Boolean.class)) {
        params.setBooleanParameter(paramName, Boolean.parseBoolean(paramValue));
    } else if (paramType.equals(Integer.class)) {
        params.setIntParameter(paramName, Integer.parseInt(paramValue));
    } else if (paramType.equals(Long.class)) {
        params.setLongParameter(paramName, Long.parseLong(paramValue));
    } else if (paramType.equals(Double.class)) {
        params.setDoubleParameter(paramName, Double.parseDouble(paramValue));
    } else if (paramType.equals(String.class)) {
        params.setParameter(paramName, paramValue);
    } else if (paramType.equals(Class.class)) {
        try {//from w  ww .  ja  va 2 s. c om
            Class<?> configuredClass = Class.forName(paramValue, true,
                    ClassLoaderUtils.getDefaultClassLoader());
            params.setParameter(paramName, configuredClass);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not locate the class needed to configure the HttpClient.", e);
        }
    } else {
        throw new RuntimeException("Attempted to configure an HttpClient parameter '" + paramName + "' "
                + "of a type not supported through Workflow configuration: " + paramType.getName());
    }
}