diff options
-rw-r--r-- | a1-policy-management/pom.xml | 10 | ||||
-rw-r--r-- | a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java | 36 |
2 files changed, 19 insertions, 27 deletions
diff --git a/a1-policy-management/pom.xml b/a1-policy-management/pom.xml index 338477b6..8cac379a 100644 --- a/a1-policy-management/pom.xml +++ b/a1-policy-management/pom.xml @@ -213,16 +213,6 @@ <artifactId>everit-json-schema</artifactId> <version>1.14.0</version> </dependency> - <dependency> - <groupId>org.codehaus.httpcache4j.uribuilder</groupId> - <artifactId>uribuilder</artifactId> - <version>2.0.0</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.5.13</version> - </dependency> </dependencies> <build> <plugins> diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java index f2a79cd8..eac79ad9 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java @@ -21,6 +21,9 @@ package org.onap.ccsdk.oran.a1policymanagementservice.clients; import java.lang.invoke.MethodHandles; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Set; @@ -32,7 +35,6 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import org.apache.http.client.utils.URIBuilder; /** * Client for accessing OSC A1 REST API */ @@ -99,22 +101,22 @@ public class OscA1Client implements A1Client { /** * /a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id} */ - private String createPolicyUri(String type, String id, String notificationDestination) { - String url = ""; - URIBuilder ub = null; - try { - ub = new URIBuilder(createPolicyTypeUri(type) + "/policies/" + id); - if(notificationDestination != null) { - ub.addParameter("notificationDestination", notificationDestination); - } - url = ub.toString(); - } - catch(Exception e) { - String exceptionString = e.toString(); - logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, exceptionString); - } - return url; - } + private String createPolicyUri(String type, String id, String notificationDestination) { + try { + String baseUrl = createPolicyTypeUri(type); + String url = baseUrl + "/policies/" + id; + if (notificationDestination != null) { + url += "?notificationDestination=" + + URLEncoder.encode(notificationDestination, StandardCharsets.UTF_8.toString()); + } + return new URI(url).toString(); + } catch (Exception e) { + String exceptionString = e.getMessage(); + logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, + exceptionString); + return ""; + } + } /** * /a1-p/policytypes/{policy_type_id} |