summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorMichal Kabaj <michal.kabaj@nokia.com>2018-12-17 17:10:24 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-01-04 12:02:36 +0000
commit61b78a7d5f1eb8f1c5955d6d1439ce9225a39b46 (patch)
tree4f6ab37c32786ad489f6d8f2130d1b03105f8c32 /mso-api-handlers
parent85a47c701c3b34c58d2b121ba466d41ffb4fb7b0 (diff)
HttpClientFactory to create HttpClient instances
-Replace constructor calls with existing factory -Add create methods to factory for each required Media Type Change-Id: Ibd03c10230c87a0413c0ec529e0ea9ac800444f9 Issue-ID: SO-1344 Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index 8a4d561fbd..4e8e9562ce 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -21,9 +21,6 @@
package org.onap.so.apihandlerinfra.tenantisolation.helpers;
import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
@@ -36,6 +33,7 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.client.HttpClient;
+import org.onap.so.client.HttpClientFactory;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
@@ -53,6 +51,7 @@ public class SDCClientHelper {
private static String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
private static String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
+ private final HttpClientFactory httpClientFactory = new HttpClientFactory();
@Value("${mso.sdc.endpoint}")
private String sdcEndpoint;
@@ -91,7 +90,7 @@ public class SDCClientHelper {
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
httpClient.addBasicAuthHeader(sdcClientAuth, msoKey);
Response apiResponse = setHttpPostResponse(httpClient, jsonPayload);