summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSooriyaa <soponraj@in.ibm.com>2018-09-17 13:12:26 +0530
committerSooriyaa <soponraj@in.ibm.com>2018-09-17 13:12:38 +0530
commitb9e909cd35c4a0704ad9d03ef3d16a34efa0fe18 (patch)
tree4b534af7d432b6cc88bfb940a8615ad7f21dca31
parentef04f4aeb7d243e12c6c65122487d7037ef46e46 (diff)
Fixing sonar issue in HttpClientUtil.java
Fixing sonar issue in HttpClientUtil.java Issue-ID: VFC-1133 Change-Id: I168d97231f05fed548e53e8f4f1b0f91eae49a04 Signed-off-by: Sooriyaa <soponraj@in.ibm.com>
-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();