axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VASQUEZ_JA...@LILLY.COM
Subject Handling of server config from EngineConfigurationFactoryServlet
Date Fri, 06 Sep 2002 16:02:45 GMT
Hi all,

I'm pretty new to this project, but I have run accross a problem where the 
default server-config.wsdd is not handled as would be expected (at least 
by a newbie like me!).  Using the AdminClient, updates never occur, 
because FileProvider is called with it's InputStream constructor instead 
of a filename based constructor.  (Maybe this is on purpose for security 
reasons? Then why do we care about the remote administration option?)

I've patched up EngineConfigurationFactoryServlet so that getServerEngineConfig(ServletContext
ctx) seems to be behave a bit more 
nicely.  I've attached a patch to the latest CVS sources, I'd appreciate 
some feedback as to whether or not I'm way off track with this!

Thanks,
Jason

The patch:
Index: EngineConfigurationFactoryServlet.java
===================================================================
RCS file: 
/home/cvspublic/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v
retrieving revision 1.7
diff -c -r1.7 EngineConfigurationFactoryServlet.java
*** EngineConfigurationFactoryServlet.java      30 Aug 2002 19:13:05 -0000 
     1.7
--- EngineConfigurationFactoryServlet.java      6 Sep 2002 16:00:49 -0000
***************
*** 55,63 ****
--- 55,67 ----

  package org.apache.axis.configuration;

+ import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;

+ import java.net.MalformedURLException;
+ import java.net.URL;
+
  import javax.servlet.ServletContext;

  import org.apache.axis.EngineConfiguration;
***************
*** 146,167 ****
           * snooped by a browser)
           */
          String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
!         InputStream is = ctx.getResourceAsStream(name);

!         FileProvider config;
!         if (is == null) {
              String rootPath = ctx.getRealPath("/");
              if (rootPath != null) {
                  name = rootPath + name;
              }
!             log.error(JavaUtils.getMessage("servletEngineWebInfError01",
                                             name));
-             config = null;
-         } else {
-             // FileProvider assumes responsibility for 'is'.
-             config = new FileProvider(is);
          }

!         return config;
      }
  }
--- 150,179 ----
           * snooped by a browser)
           */
          String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
!         URL configUrl = null;

!               try {
!                       configUrl = ctx.getResource(name);
!               } catch (MalformedURLException e) { }
!
!               FileProvider config = null;
!               if (configUrl != null) {
!                       config = new 
FileProvider(configUrl.getFile().toString());
!               } else {
              String rootPath = ctx.getRealPath("/");
              if (rootPath != null) {
                  name = rootPath + name;
+                               File f = new File(name);
+                               if (f.exists()) {
+                                       config = new 
FileProvider(f.toString());
+                               }
              }
!
!                       if (config == null) //if it's still null now
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
                                             name));
          }

!               return config;
      }
  }

Mime
View raw message