/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.util.EntityUtils;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Client used to send RESTFul requests.
* <p>
* @since 1.0
*/
public class RESTClient {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private final String proxyHost;
private final int proxyPort;
}
}
} catch (UnsupportedEncodingException e) {
- // should not occur
- e.printStackTrace();
+ LOGGER.debug("Exception :", e);
}
return sb.toString();
}
clientBuilder = HttpClientBuilder.create().setConnectionManager(
manager);
} catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
throw new RESTException(ex.getMessage());
}
clientBuilder.disableRedirectHandling();
/**
* Creates a RESTClient with the RESTConfig object.
*
- * @param RESTConfig config to use for sending request
+ * @param restConfig config to use for sending request
*
* @throws RESTException if unable to create a RESTClient
*/
- public RESTClient(RESTConfig cfg) throws RESTException {
- this.headers = new LinkedHashMap<String, List<String>>();
- this.parameters = new LinkedHashMap<String, List<String>>();
- this.URL = cfg.getURL();
- this.proxyHost = cfg.getProxyHost();
- this.proxyPort = cfg.getProxyPort();
+ public RESTClient(RESTConfig restConfig) throws RESTException {
+ this.headers = new LinkedHashMap<>();
+ this.parameters = new LinkedHashMap<>();
+ this.URL = restConfig.getURL();
+ this.proxyHost = restConfig.getProxyHost();
+ this.proxyPort = restConfig.getProxyPort();
}
/**
*/
public RESTClient addParameter(String name, String value) {
if (!parameters.containsKey(name)) {
- parameters.put(name, new ArrayList<String>());
+ parameters.put(name, new ArrayList<>());
}
List<String> values = parameters.get(name);
*/
public RESTClient addHeader(String name, String value) {
if (!headers.containsKey(name)) {
- headers.put(name, new ArrayList<String>());
+ headers.put(name, new ArrayList<>());
}
List<String> values = headers.get(name);