diff options
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java index 5ca764c1..bedd9c41 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java @@ -74,6 +74,8 @@ public class MenuListController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MenuListController.class); + private static final String APPLICATION_JSON = "application/json"; + @Autowired private FnMenuService fnMenuService; @Autowired @@ -110,7 +112,7 @@ public class MenuListController extends RestrictedBaseController { JsonMessage msg = new JsonMessage(mapper.writeValueAsString(parentList), mapper.writeValueAsString(childItemList), userName); JSONObject j = new JSONObject(msg); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); logger.debug(EELFLoggerDelegate.debugLogger, "getMenu ends"); } catch (Exception e) { @@ -132,12 +134,12 @@ public class MenuListController extends RestrictedBaseController { try { String appName = (String) session .getAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)); - if (appName != null && appName.equals("app_display_name")) { + if (appName != null && "app_display_name".equals(appName)) { appName = ""; } JsonMessage msg = new JsonMessage(appName); JSONObject j = new JSONObject(msg); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); logger.debug(EELFLoggerDelegate.debugLogger, "getAppName ends"); } catch (Exception e) { @@ -194,7 +196,7 @@ public class MenuListController extends RestrictedBaseController { String contextId = null; if (request.getCookies() != null) { for (Cookie ck : request.getCookies()) { - if (ck.getName().equalsIgnoreCase("EPService")) + if ("EPService".equalsIgnoreCase(ck.getName())) contextId = ck.getValue(); } } @@ -207,7 +209,7 @@ public class MenuListController extends RestrictedBaseController { model.put(sharedContext.getCkey(), sharedContext.getCvalue()); } JSONObject j = new JSONObject(model); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserInfo failed", e); @@ -248,7 +250,7 @@ public class MenuListController extends RestrictedBaseController { isAppCentralized = true; map.put("isAppCentralized", Boolean.toString(isAppCentralized)); JSONObject j = new JSONObject(map); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON", e); |