From 400408a5bf555ddca5521e1f7c44d256ab941c01 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Wed, 13 Jul 2022 17:05:40 -0400 Subject: Restapi-call-node: Support for Empty Container {} in JSON Issue-ID: CCSDK-3718 Signed-off-by: Singal, Kapil (ks220y) Change-Id: If3c030f3de78d21f1ab0bcdebc234b7697871314 --- .../onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java | 10 ++++++---- .../org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'plugins/restapi-call-node/provider/src/main/java/org') diff --git a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java index 4236055dc..2064dc864 100755 --- a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java +++ b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java @@ -641,6 +641,8 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { if (format == Format.JSON) { req = XmlJsonUtil.removeLastCommaJson(req); + // Use 'EMPTY_CONTAINER' as keyword within template to have an empty container placeholder. + req = req.replaceAll("EMPTY_CONTAINER", "{}"); } long t2 = System.currentTimeMillis(); @@ -803,7 +805,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { URL proxyUrl = new URL(p.proxyUrl); HttpUrlConnectorProvider cp = new HttpUrlConnectorProvider(); config.connectorProvider(cp); - final Proxy proxy = + final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl.getHost(), proxyUrl.getPort())); cp.connectionFactory(new ConnectionFactory() { @@ -822,12 +824,12 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { ssl = createSSLContext(p); } - ClientBuilder builder = + ClientBuilder builder = ClientBuilder.newBuilder().hostnameVerifier(new AcceptIpAddressHostNameVerifier()); - if (ssl != null) { + if (ssl != null) { HttpsURLConnection.setDefaultSSLSocketFactory(ssl.getSocketFactory()); - builder = builder.sslContext(ssl); + builder = builder.sslContext(ssl); } if (config != null) { builder = builder.withConfig(config); diff --git a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java index d6ef7463a..a4407c005 100644 --- a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java +++ b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java @@ -443,7 +443,6 @@ public final class XmlJsonUtil { i5 = s.length(); } - /*If template mandates empty construct to be present, those should not be removed.*/ if (template != null && template.contains(s.substring(i4))) { k = i1 + 1; -- cgit 1.2.3-korg