| PortletSessionListenerLoader.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.kernel.servlet;
16
17 import javax.servlet.ServletContextEvent;
18 import javax.servlet.ServletContextListener;
19 import javax.servlet.http.HttpSessionListener;
20
21 /**
22 * <a href="PortletSessionListenerLoader.java.html"><b><i>View Source</i></b>
23 * </a>
24 *
25 * <p>
26 * See http://issues.liferay.com/browse/LEP-2299.
27 * </p>
28 *
29 * @author Olaf Fricke
30 * @author Brian Wing Shun Chan
31 */
32 public class PortletSessionListenerLoader implements ServletContextListener {
33
34 public PortletSessionListenerLoader(HttpSessionListener listener) {
35 _listener = listener;
36 }
37
38 public void contextInitialized(ServletContextEvent event) {
39 PortletSessionListenerManager.addListener(_listener);
40 }
41
42 public void contextDestroyed(ServletContextEvent event) {
43 PortletSessionListenerManager.removeListener(_listener);
44
45 _listener = null;
46 }
47
48 private HttpSessionListener _listener;
49
50 }