summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Yang <yangyanyj@chinamobile.com>2018-09-18 04:09:30 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-18 04:09:30 +0000
commit661069ce933bdea2e5f93157ad4bc069a66f9c14 (patch)
treec5726067dabf5a33e321c5d10be94a05e87a191d
parent43e086a7f61b4e2f3c33e56cb814a5762796cb9d (diff)
parentb9e909cd35c4a0704ad9d03ef3d16a34efa0fe18 (diff)
Merge "Fixing sonar issue in HttpClientUtil.java"
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/HttpClientUtil.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/HttpClientUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/HttpClientUtil.java
index e4bcae9..393e257 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/HttpClientUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/HttpClientUtil.java
@@ -35,6 +35,7 @@ import org.apache.http.util.EntityUtils;
public class HttpClientUtil {
private static final Logger log = LoggerFactory.getLogger(HttpClientUtil.class);
+ public static final String APPLICATION_JSON = "application/json";
public static String doPost(String url, String json, String charset) {
String result = null;
@@ -44,7 +45,7 @@ public class HttpClientUtil {
if (null != json) {
StringEntity s = new StringEntity(json);
s.setContentEncoding("UTF-8");
- s.setContentType("application/json"); // set contentType
+ s.setContentType(APPLICATION_JSON); // set contentType
httpPost.setEntity(s);
}
try(CloseableHttpResponse response = httpClient.execute(httpPost)){
@@ -90,8 +91,8 @@ public class HttpClientUtil {
try (
CloseableHttpClient httpClient = HttpClients.createDefault()){
HttpGet httpGet = new HttpGet(url);
- httpGet.setHeader("Content-Type", "application/json");
- httpGet.setHeader("Accept", "application/json");
+ httpGet.setHeader("Content-Type", APPLICATION_JSON);
+ httpGet.setHeader("Accept", APPLICATION_JSON);
httpGet.setHeader("X-TransactionId", "111");
httpGet.setHeader("X-FromAppId", "ems-driver");
Base64 token = new Base64();