KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > integrationtests > framework > web > RemoteContextListener


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.integrationtests.framework.web;
5
6 import javax.servlet.ServletContextEvent JavaDoc;
7 import javax.servlet.ServletContextListener JavaDoc;
8
9 import org.springframework.context.support.ClassPathXmlApplicationContext;
10 import org.springframework.web.context.WebApplicationContext;
11 import org.springframework.web.context.support.WebApplicationContextUtils;
12
13 public class RemoteContextListener implements ServletContextListener JavaDoc {
14
15   private ClassPathXmlApplicationContext remoteAppCtx;
16
17   public void contextInitialized(ServletContextEvent JavaDoc event) {
18     WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
19     remoteAppCtx = new ClassPathXmlApplicationContext(
20         new String JavaDoc[] { "classpath:/com/tctest/spring/spring-remoting.xml" }, wac);
21
22   }
23
24   public void contextDestroyed(ServletContextEvent JavaDoc event) {
25     remoteAppCtx.close();
26   }
27
28 }
29
Popular Tags