summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java67
1 files changed, 29 insertions, 38 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
index 4fc7e188..548ad986 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
@@ -6,7 +6,7 @@
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the “License”);
+ * under the Apache License, Version 2.0 (the "License");
* you may not use this software except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -19,7 +19,7 @@
* limitations under the License.
*
* Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
* you may not use this documentation except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -38,11 +38,9 @@
package org.onap.portalapp.controller.core;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import org.onap.portalsdk.core.controller.UnRestrictedBaseController;
import org.onap.portalsdk.core.domain.User;
-import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
@@ -56,67 +54,61 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/")
-public class LogoutController extends UnRestrictedBaseController{
+public class LogoutController extends UnRestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogoutController.class);
private User user;
-
+
/**
+ *
+ * invalidates the current application session, then redirects to portal logout
+ *
* @param request
- * @param response
* @return modelView
- *
- * globalLogout will invalid the current application session, then redirects to portal logout
*/
- @RequestMapping(value = {"/logout.htm" }, method = RequestMethod.GET)
- public ModelAndView globalLogout(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value = { "/logout.htm" }, method = RequestMethod.GET)
+ public ModelAndView globalLogout(HttpServletRequest request) {
ModelAndView modelView = null;
- try{
+ try {
chatRoomLogout(request);
request.getSession().invalidate();
- String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
String portalDomain = portalUrl.substring(0, portalUrl.lastIndexOf('/'));
- String redirectUrl = portalDomain+"/logout.htm";
- modelView = new ModelAndView("redirect:"+redirectUrl);
- }catch(Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, "Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ String redirectUrl = portalDomain + "/logout.htm";
+ modelView = new ModelAndView("redirect:" + redirectUrl);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Logout failed", e);
}
return modelView;
}
/**
+ *
+ * invalidates the current session (application logout) and redirects user to
+ * Portal.
+ *
* @param request
- * @param response
* @return modelView
- *
- * appLogout is a function that will invalid the current session (application logout) and redirects user to Portal.
*/
- @RequestMapping(value = {"/app_logout.htm" }, method = RequestMethod.GET)
- public ModelAndView appLogout(HttpServletRequest request, HttpServletResponse response) {
+ @RequestMapping(value = { "/app_logout.htm" }, method = RequestMethod.GET)
+ public ModelAndView appLogout(HttpServletRequest request) {
ModelAndView modelView = null;
- try{
+ try {
chatRoomLogout(request);
- modelView = new ModelAndView("redirect:"+PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL));
- UserUtils.clearUserSession(request);
+ modelView = new ModelAndView(
+ "redirect:" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL));
+ UserUtils.clearUserSession(request);
request.getSession().invalidate();
- }catch(Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, "Application Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Application Logout failed", e);
}
return modelView;
}
-
- public void chatRoomLogout(HttpServletRequest request){
- request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
+ public void chatRoomLogout(HttpServletRequest request) {
+ request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
setUser(UserUtils.getUserSession(request));
- // if(getUser()!=null){
- // Long login_IdLong = getUser().getId();
- // String name = getUser().getFirstName();
- // String login_IdStr = Long.toString(login_IdLong);
- // }
- //UserListName.getInstance().delUserName(name);
- //UserListID.getInstance().delUserName(login_IdStr);
}
public User getUser() {
@@ -127,5 +119,4 @@ public class LogoutController extends UnRestrictedBaseController{
this.user = user;
}
-
}