aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java13
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClientFactory.java10
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java9
3 files changed, 23 insertions, 9 deletions
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
index 63a4b1cd65..eaeb0ab6c6 100644
--- a/common/src/main/java/org/onap/so/client/HttpClient.java
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -24,22 +24,27 @@ import java.net.URL;
import java.util.Map;
import java.util.Optional;
import static org.apache.commons.lang3.StringUtils.*;
-import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpClient extends RestClient {
protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
- private ONAPComponents targetEntity;
+ private ONAPComponentsList targetEntity;
- HttpClient(URL host, String contentType, ONAPComponents targetEntity) {
+ HttpClient(URL host, String contentType, ONAPComponentsList targetEntity) {
super(host, contentType);
this.targetEntity = targetEntity;
}
+ HttpClient(URL host, String acceptType, String contentType, ONAPComponentsList targetEntity) {
+ super(host, acceptType, contentType);
+ this.targetEntity = targetEntity;
+ }
+
@Override
- public ONAPComponents getTargetEntity() {
+ public ONAPComponentsList getTargetEntity() {
return targetEntity;
}
diff --git a/common/src/main/java/org/onap/so/client/HttpClientFactory.java b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
index 3a8a9ee1bd..84a8bb9fb1 100644
--- a/common/src/main/java/org/onap/so/client/HttpClientFactory.java
+++ b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
@@ -21,19 +21,19 @@ package org.onap.so.client;
import java.net.URL;
import javax.ws.rs.core.MediaType;
-import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
public class HttpClientFactory {
- public HttpClient newJsonClient(URL host, ONAPComponents targetEntity) {
+ public HttpClient newJsonClient(URL host, ONAPComponentsList targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_JSON, targetEntity);
}
- public HttpClient newXmlClient(URL host, ONAPComponents targetEntity) {
+ public HttpClient newXmlClient(URL host, ONAPComponentsList targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_XML, targetEntity);
}
- public HttpClient newTextXmlClient(URL host, ONAPComponents targetEntity) {
- return new HttpClient(host, MediaType.TEXT_XML, targetEntity);
+ public HttpClient newTextXmlClient(URL host, ONAPComponentsList targetEntity) {
+ return new HttpClient(host, MediaType.TEXT_XML, MediaType.TEXT_XML, targetEntity);
}
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 30389de742..ece1333f83 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -104,6 +104,15 @@ public abstract class RestClient {
this.props = new DefaultProperties(host);
}
+ protected RestClient(URL host, String acceptType, String contentType) {
+ headerMap = new HashMap<>();
+ this.path = Optional.empty();
+ this.host = host;
+ this.accept = acceptType;
+ this.contentType = contentType;
+ this.props = new DefaultProperties(host);
+ }
+
/**
* Override method to return false to disable logging.
*