summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java
index 8b740d0b..c9c666fb 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java
@@ -37,6 +37,7 @@
*/
package org.onap.portalapp.controller.sample;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
@@ -65,6 +66,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class BroadcastListController extends RestrictedBaseController {
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(BroadcastListController.class);
+ private static final String UTF8 = "UTF-8";
+
@Autowired
private BroadcastService broadcastService;
@@ -78,7 +81,7 @@ public class BroadcastListController extends RestrictedBaseController {
@RequestMapping(value = { "/get_broadcast_list" }, method = RequestMethod.GET)
public void getBroadcast(HttpServletRequest request, HttpServletResponse response) {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
try {
model.put("model", broadcastService.getBcModel(request));
@@ -94,7 +97,7 @@ public class BroadcastListController extends RestrictedBaseController {
}
@RequestMapping(value = { "/broadcast_list/remove" }, method = RequestMethod.POST)
- public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
@@ -106,9 +109,9 @@ public class BroadcastListController extends RestrictedBaseController {
broadcastService.removeBroadcastMessage(broadcastMessage);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
response.setContentType("application / json");
- request.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(broadcastMessage);
@@ -118,8 +121,8 @@ public class BroadcastListController extends RestrictedBaseController {
return null;
} catch (Exception e) {
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred while removing the BroadcastMessage in the remove ()");
logger.error(EELFLoggerDelegate.errorLogger, "remove() failed", e);
@@ -129,7 +132,7 @@ public class BroadcastListController extends RestrictedBaseController {
}
@RequestMapping(value = { "/broadcast_list/toggleActive" }, method = RequestMethod.POST)
- public ModelAndView toggleActive(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView toggleActive(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
@@ -141,9 +144,9 @@ public class BroadcastListController extends RestrictedBaseController {
broadcastService.saveBroadcastMessage(broadcastMessage);
- response.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
response.setContentType("application / json");
- request.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(broadcastMessage);
@@ -153,8 +156,8 @@ public class BroadcastListController extends RestrictedBaseController {
return null;
} catch (Exception e) {
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
+ response.setCharacterEncoding(UTF8);
+ request.setCharacterEncoding(UTF8);
PrintWriter out = response.getWriter();
out.write("An error occurred while saving the BroadcastMessage in the toggleActive () ");
logger.error(EELFLoggerDelegate.errorLogger, "toggleActive() failed", e);