gdaniels 2003/01/30 10:37:40 Modified: java/src/org/apache/axis/configuration EngineConfigurationFactoryServlet.java Log: Respect the axis.ServerConfigFile system property when in a servlet context. As it stands, if we don't find a specified config file, we will fall back to the default "server-config.wsdd" in the axis.jar file. Revision Changes Path 1.21 +16 -5 xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java Index: EngineConfigurationFactoryServlet.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- EngineConfigurationFactoryServlet.java 11 Dec 2002 22:38:11 -0000 1.20 +++ EngineConfigurationFactoryServlet.java 30 Jan 2003 18:37:40 -0000 1.21 @@ -58,6 +58,7 @@ import org.apache.axis.ConfigurationException; import org.apache.axis.EngineConfiguration; import org.apache.axis.EngineConfigurationFactory; +import org.apache.axis.AxisProperties; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.server.AxisServer; import org.apache.axis.utils.ClassUtils; @@ -142,7 +143,15 @@ * @param ctx a ServletContext * @return a server EngineConfiguration */ - private static EngineConfiguration getServerEngineConfig(ServletContext ctx) { + private static + EngineConfiguration getServerEngineConfig(ServletContext ctx) { + // Respect the system property setting for a different config file + String configFile = + AxisProperties.getProperty(OPTION_SERVER_CONFIG_FILE); + if (configFile == null) { + configFile = SERVER_CONFIG_FILE; + } + /** * Flow can be confusing. Here is the logic: * 1) Make all attempts to open resource IF it exists @@ -172,9 +181,9 @@ * or WAR file). */ if (realWebInfPath == null || - !(new File(realWebInfPath, SERVER_CONFIG_FILE)).exists()) + !(new File(realWebInfPath, configFile)).exists()) { - String name = appWebInfPath + "/" + SERVER_CONFIG_FILE; + String name = appWebInfPath + "/" + configFile; InputStream is = ctx.getResourceAsStream(name); if (is != null) { // FileProvider assumes responsibility for 'is': @@ -195,7 +204,7 @@ */ if (config == null && realWebInfPath != null) { try { - config = new FileProvider(realWebInfPath, SERVER_CONFIG_FILE); + config = new FileProvider(realWebInfPath, configFile); } catch (ConfigurationException e) { log.error(Messages.getMessage("servletEngineWebInfError00"), e); } @@ -207,7 +216,9 @@ if (config == null) { log.warn(Messages.getMessage("servletEngineWebInfWarn00")); try { - InputStream is = ClassUtils.getResourceAsStream(AxisServer.class, SERVER_CONFIG_FILE); + InputStream is = + ClassUtils.getResourceAsStream(AxisServer.class, + SERVER_CONFIG_FILE); config = new FileProvider(is); } catch (Exception e) { log.error(Messages.getMessage("servletEngineWebInfError02"), e);