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 com.liferay.portal.kernel.deploy.hot.HotDeployEvent;
18  import com.liferay.portal.kernel.deploy.hot.HotDeployUtil;
19  
20  import javax.servlet.ServletContext;
21  import javax.servlet.ServletContextEvent;
22  import javax.servlet.ServletContextListener;
23  
24  /**
25   * <a href="ThemeContextListener.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Ivica Cardic
28   * @author Brian Wing Shun Chan
29   */
30  public class ThemeContextListener implements ServletContextListener {
31  
32      public void contextInitialized(ServletContextEvent event) {
33          ServletContext servletContext = event.getServletContext();
34  
35          Thread currentThread = Thread.currentThread();
36  
37          ClassLoader contextClassLoader = currentThread.getContextClassLoader();
38  
39          HotDeployUtil.fireDeployEvent(
40              new HotDeployEvent(servletContext, contextClassLoader));
41      }
42  
43      public void contextDestroyed(ServletContextEvent event) {
44          ServletContext servletContext = event.getServletContext();
45  
46          Thread currentThread = Thread.currentThread();
47  
48          ClassLoader contextClassLoader = currentThread.getContextClassLoader();
49  
50          HotDeployUtil.fireUndeployEvent(
51              new HotDeployEvent(servletContext, contextClassLoader));
52      }
53  
54  }