aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-04-29 15:34:40 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-29 15:34:40 +0000
commit23c402203aa8bba6fd2f93e9d95871a40f22b4ed (patch)
tree52339ef7489908b3efd776d97b94c9a6a7a1d7e1 /common
parent589118aacdc22bb5c2a975d857c4f2e62340bf8b (diff)
parent53646dabc6359e2635c48e201659b6f63a28de06 (diff)
Merge "Changed the text xml client to always set the"
Diffstat (limited to 'common')
-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.
*