2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalsdk.core.onboarding.listener;
22 import java.io.Serializable;
24 import javax.servlet.http.HttpSession;
25 import javax.servlet.http.HttpSessionBindingEvent;
26 import javax.servlet.http.HttpSessionBindingListener;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants;
32 public class PortalTimeoutBindingListener implements HttpSessionBindingListener, Serializable {
34 private final Log logger = LogFactory.getLog(getClass());
36 private static final long serialVersionUID = 1L;
39 public void valueBound(HttpSessionBindingEvent event) {
40 final HttpSession session = event.getSession();
41 PortalTimeoutHandler.sessionMap.put((String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID),
46 public void valueUnbound(HttpSessionBindingEvent event) {
47 final HttpSession session = event.getSession();
48 String portalJSessionId = (String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID);
49 logger.debug(portalJSessionId + " getting removed");
50 PortalTimeoutHandler.sessionMap.remove(portalJSessionId);