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