aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-04-28 15:23:02 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-28 15:35:03 -0400
commit53646dabc6359e2635c48e201659b6f63a28de06 (patch)
tree8b1f4c888c0f86af416cce755b19e9d514e74fe8 /common
parentac42fe6ee5e461c3053d40f23cc62882b6a59fe5 (diff)
Changed the text xml client to always set the
Changed the text xml client to always set the accept type to text xml. Forgot to assign the accept type in rest client Issue-ID: SO-2838 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ia86e53327c6e126fcee6a15b5cd3e5f5c4ec9390
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.
*