X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FPolicyNotificationController.java;h=ebd24dce3819993aca5c61e87916450ea94a9cb8;hp=51bc3e9875400fe1ed97cb3fc9abd09f9580878e;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java index 51bc3e987..ebd24dce3 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java @@ -30,7 +30,6 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import java.io.File; import java.io.IOException; -import java.io.PrintWriter; import java.util.List; import javax.script.SimpleBindings; @@ -71,6 +70,11 @@ public class PolicyNotificationController extends RestrictedBaseController { StringBuilder path = new StringBuilder(); String responseValue = ""; try { + response.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING); + request.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING); + // + // + // String userId = UserUtils.getUserSession(request).getOrgUserId(); logger.info("userid info: " + userId); ObjectMapper mapper = new ObjectMapper(); @@ -118,18 +122,13 @@ public class PolicyNotificationController extends RestrictedBaseController { responseValue = "You have UnSubscribed Successfully"; } - response.setCharacterEncoding("UTF-8"); - response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); + response.setContentType(PolicyUtils.APPLICATION_JSON); response.getWriter().write(new JSONObject("{watchData: " + mapper.writeValueAsString(responseValue) + "}").toString()); } catch (Exception e) { - response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); logger.error("Error druing watchPolicy function " + e); - PrintWriter out = response.getWriter(); - out.write(PolicyUtils.CATCH_EXCEPTION); + response.getWriter().write(PolicyUtils.CATCH_EXCEPTION); } return null; }