axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsi...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/configuration EngineConfigurationFactoryServlet.java XMLStringProvider.java ServletEngineConfigurationFactory.java FileProvider.java
Date Thu, 12 Sep 2002 19:12:20 GMT
rsitze      2002/09/12 12:12:20

  Modified:    java/src/org/apache/axis/configuration
                        EngineConfigurationFactoryServlet.java
                        XMLStringProvider.java
                        ServletEngineConfigurationFactory.java
                        FileProvider.java
  Log:
  Take II: fix servlet config file problem.
  
  Revision  Changes    Path
  1.11      +13 -24    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EngineConfigurationFactoryServlet.java	9 Sep 2002 21:49:07 -0000	1.10
  +++ EngineConfigurationFactoryServlet.java	12 Sep 2002 19:12:20 -0000	1.11
  @@ -145,38 +145,27 @@
        */
       private static EngineConfiguration getServerEngineConfig(ServletContext ctx) {
           /*
  -         * Use the WEB-INF directory (so the config files can't get
  -         * snooped by a browser)
  +         * Use the WEB-INF directory
  +         * (so the config files can't get snooped by a browser)
            */
  -        String webInfPath = "/WEB-INF/";
  -        String serverConfigFileName = webInfPath + SERVER_CONFIG_FILE;
  +        String appWebInfPath = "/WEB-INF";
   
  -        URL configURL;
  -        try {
  -            configURL = ctx.getResource(serverConfigFileName);
  -        } catch (MalformedURLException e) {
  -            configURL = null;
  -        }
  +        String realWebInfPath = ctx.getRealPath(appWebInfPath);
   
           FileProvider config = null;
  -        if (configURL != null) {
  -            config = new FileProvider(configURL.getFile().toString());
  -        } else {
  -            String realWebInfPath = ctx.getRealPath(webInfPath);
  -            if (realWebInfPath != null  &&
  -                (new File(realWebInfPath, SERVER_CONFIG_FILE)).exists()) {
  +        if (realWebInfPath != null  &&
  +            (new File(realWebInfPath, SERVER_CONFIG_FILE)).exists()) {
   
  -                try {
  -                    config = new FileProvider(realWebInfPath, SERVER_CONFIG_FILE);
  -                } catch (ConfigurationException e) {
  -                    log.error(Messages.getMessage("servletEngineWebInfError00"),
  -                              e);
  -                }
  +            try {
  +                config = new FileProvider(realWebInfPath, SERVER_CONFIG_FILE);
  +            } catch (ConfigurationException e) {
  +                log.error(Messages.getMessage("servletEngineWebInfError00"), e);
               }
           }
           
           if (config == null) {
  -            InputStream is = ctx.getResourceAsStream(serverConfigFileName);
  +            String appServerConfigFileName = appWebInfPath + "/" + SERVER_CONFIG_FILE;
  +            InputStream is = ctx.getResourceAsStream(appServerConfigFileName);
               if (is != null) {
                   // FileProvider assumes responsibility for 'is':
                   // do NOT call is.close().
  @@ -185,7 +174,7 @@
   
               if (config == null) {
                   log.error(Messages.getMessage("servletEngineWebInfError01",
  -                                               serverConfigFileName));
  +                                               appServerConfigFileName));
               }
           }
   
  
  
  
  1.8       +1 -1      xml-axis/java/src/org/apache/axis/configuration/XMLStringProvider.java
  
  Index: XMLStringProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/XMLStringProvider.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLStringProvider.java	26 Jun 2002 18:22:25 -0000	1.7
  +++ XMLStringProvider.java	12 Sep 2002 19:12:20 -0000	1.8
  @@ -105,7 +105,7 @@
       }
   
       public void configureEngine(AxisEngine engine) throws ConfigurationException {
  -        myInputStream = new ByteArrayInputStream(xmlConfiguration.getBytes());
  +        setInputStream(new ByteArrayInputStream(xmlConfiguration.getBytes()));
           super.configureEngine(engine);
       }
   }
  
  
  
  1.15      +1 -1      xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java
  
  Index: ServletEngineConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ServletEngineConfigurationFactory.java	28 Aug 2002 03:15:11 -0000	1.14
  +++ ServletEngineConfigurationFactory.java	12 Sep 2002 19:12:20 -0000	1.15
  @@ -59,7 +59,7 @@
   
   /**
    * This is a 'front' for replacement logic.
  - * Use EngineConfigurationFactoryFinder.newServletFactory().
  + * Use EngineConfigurationFactoryFinder.newFactory(yourServletContext).
    * 
    * @author Richard A. Sitze
    * @author Glyn Normington (glyn@apache.org)
  
  
  
  1.38      +20 -13    xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
  
  Index: FileProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- FileProvider.java	9 Sep 2002 17:03:21 -0000	1.37
  +++ FileProvider.java	12 Sep 2002 19:12:20 -0000	1.38
  @@ -100,19 +100,18 @@
       protected static Log log =
           LogFactory.getLog(FileProvider.class.getName());
   
  -    protected WSDDDeployment deployment = null;
  +    private WSDDDeployment deployment = null;
   
  -    private static final String CURRENT_DIR = ".";
  -    protected String filename;
  -    protected File configFile = null;
  +    private String filename;
  +    private File configFile = null;
   
  -    protected InputStream myInputStream = null;
  +    private InputStream myInputStream = null;
   
  -    protected boolean readOnly = true;
  +    private boolean readOnly = true;
   
       // Should we search the classpath for the file if we don't find it in
       // the specified location?
  -    boolean searchClasspath = true;
  +    private boolean searchClasspath = true;
   
       /**
        * Constructor which accesses a file in the current directory of the
  @@ -169,8 +168,16 @@
        * Note: The configuration will be read-only in this case!
        */
       public FileProvider(InputStream is) {
  +        setInputStream(is);
  +    }
  +    
  +    public void setInputStream(InputStream is) {
           myInputStream = is;
       }
  +    
  +    private InputStream getInputStream() {
  +        return myInputStream;
  +    }
   
       public WSDDDeployment getDeployment() {
           return deployment;
  @@ -193,28 +200,28 @@
       public void configureEngine(AxisEngine engine)
           throws ConfigurationException {
           try {
  -            if (myInputStream == null) {
  +            if (getInputStream() == null) {
                   try {
  -                    myInputStream = new FileInputStream(configFile);
  +                    setInputStream(new FileInputStream(configFile));
                   } catch (Exception e) {
                       if (searchClasspath)
  -                        myInputStream = ClassUtils.getResourceAsStream(engine.getClass(),
filename);
  +                        setInputStream(ClassUtils.getResourceAsStream(engine.getClass(),
filename));
                   }
               }
   
  -            if (myInputStream == null) {
  +            if (getInputStream() == null) {
                   throw new ConfigurationException(
                           Messages.getMessage("noConfigFile"));
               }
   
               WSDDDocument doc = new WSDDDocument(XMLUtils.
  -                                                newDocument(myInputStream));
  +                                                newDocument(getInputStream()));
               deployment = doc.getDeployment();
   
               deployment.configureEngine(engine);
               engine.refreshGlobalOptions();
   
  -            myInputStream = null;
  +            setInputStream(null);
           } catch (Exception e) {
               throw new ConfigurationException(e);
           }
  
  
  

Mime
View raw message