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