1 5 package com.opensymphony.webwork.util; 6 7 import com.opensymphony.xwork.config.Configuration; 8 import com.opensymphony.xwork.config.ConfigurationManager; 9 import com.opensymphony.xwork.config.entities.PackageConfig; 10 11 import javax.servlet.ServletContextEvent ; 12 import javax.servlet.ServletContextListener ; 13 import java.util.Iterator ; 14 15 16 26 public class ResolverSetupServletContextListener implements ServletContextListener { 27 29 public void contextDestroyed(ServletContextEvent event) { 30 } 31 32 public void contextInitialized(ServletContextEvent event) { 33 Configuration config = ConfigurationManager.getConfiguration(); 34 String key; 35 PackageConfig packageConfig; 36 37 for (Iterator iter = config.getPackageConfigNames().iterator(); 38 iter.hasNext();) { 39 key = (String ) iter.next(); 40 packageConfig = config.getPackageConfig(key); 41 42 if (packageConfig.getExternalRefResolver() instanceof ServletContextAware) { 43 ((ServletContextAware) packageConfig.getExternalRefResolver()).setServletContext(event.getServletContext()); 44 } 45 } 46 } 47 } 48 | Popular Tags |