01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.test.server.appserver.deployment;
05:
06: import javax.servlet.ServletContextEvent;
07: import javax.servlet.ServletContextListener;
08:
09: 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 {
14:
15: private ClassPathXmlApplicationContext remoteAppCtx;
16:
17: public void contextInitialized(ServletContextEvent event) {
18: WebApplicationContext wac = WebApplicationContextUtils
19: .getRequiredWebApplicationContext(event
20: .getServletContext());
21: remoteAppCtx = new ClassPathXmlApplicationContext(
22: new String[] { "classpath:/com/tctest/spring/spring-remoting.xml" },
23: wac);
24:
25: }
26:
27: public void contextDestroyed(ServletContextEvent event) {
28: remoteAppCtx.close();
29: }
30:
31: }
|