1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }