rsitze      2002/09/27 08:32:02

  Modified:    java/src/org/apache/axis/transport/http AxisServlet.java
               java/src/org/apache/axis/configuration
                        EngineConfigurationFactoryServlet.java
               java/src/org/apache/axis/server JNDIAxisServerFactory.java
  Log:
  13061 - getRealPath doesn't work for WebLogic.  This fix checks for the null, but a 
real fix is going to require to much work at this time (change path oriented logic to 
use URLs instead).
  
  Revision  Changes    Path
  1.147     +18 -6     
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- AxisServlet.java  25 Sep 2002 21:28:59 -0000      1.146
  +++ AxisServlet.java  27 Sep 2002 15:32:01 -0000      1.147
  @@ -175,8 +175,18 @@
               JavaUtils.isTrueExplicitly(getOption(context, 
INIT_PROPERTY_ENABLE_LIST, null));
   
           jwsClassDir = getOption(context, INIT_PROPERTY_JWS_CLASS_DIR, null);
  +
  +        /**
  +         * There are DEFINITATE problems here if
  +         * getHomeDir and/or getDefaultJWSClassDir return null
  +         * (as they could with WebLogic).
  +         * This needs to be reexamined in the future, but this
  +         * should fix any NPE's in the mean time.
  +         */
           if (jwsClassDir != null) {
  -            jwsClassDir = getHomeDir()+ jwsClassDir;
  +            if (getHomeDir() != null) {
  +                jwsClassDir = getHomeDir() + jwsClassDir;
  +            }
           } else {
               jwsClassDir = getDefaultJWSClassDir();
           }
  @@ -843,16 +853,16 @@
                         req.getHeader( HTTPConstants.HEADER_CONTENT_TYPE));
               log.debug("HEADER_CONTENT_LOCATION:" +
                         req.getHeader( HTTPConstants.HEADER_CONTENT_LOCATION));
  -            log.debug("Constants.MC_HOME_DIR:" +
  -                      getHomeDir());
  +            log.debug("Constants.MC_HOME_DIR:" + String.valueOf(getHomeDir()));
               log.debug("Constants.MC_RELATIVE_PATH:"+req.getServletPath());
  -            log.debug("HTTPConstants.MC_HTTP_SERVLETLOCATION:"+ getWebInfPath() );
  +            
  +            log.debug("HTTPConstants.MC_HTTP_SERVLETLOCATION:"+ 
String.valueOf(getWebInfPath()));
               log.debug("HTTPConstants.MC_HTTP_SERVLETPATHINFO:" +
                         req.getPathInfo() );
               log.debug("HTTPConstants.HEADER_AUTHORIZATION:" +
                         req.getHeader(HTTPConstants.HEADER_AUTHORIZATION));
               log.debug("Constants.MC_REMOTE_ADDR:"+req.getRemoteAddr());
  -            log.debug("configPath:" + getWebInfPath());
  +            log.debug("configPath:" + String.valueOf(getWebInfPath()));
           }
   
           /* Set the Transport */
  @@ -938,7 +948,9 @@
        * @return directory for JWS files
        */
       protected String getDefaultJWSClassDir() {
  -        return getWebInfPath() + File.separator +  "jwsClasses";
  +        return (getWebInfPath() == null)
  +               ? null  // ??? what is a good FINAL default for WebLogic?
  +               : getWebInfPath() + File.separator +  "jwsClasses";
       }
   
       /**
  
  
  
  1.17      +29 -15    
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- EngineConfigurationFactoryServlet.java    23 Sep 2002 16:17:46 -0000      1.16
  +++ EngineConfigurationFactoryServlet.java    27 Sep 2002 15:32:02 -0000      1.17
  @@ -168,24 +168,35 @@
           FileProvider config = null;
   
           String realWebInfPath = ctx.getRealPath(appWebInfPath);
  -        if (realWebInfPath == null) {
  -            File configFile = new File(realWebInfPath, SERVER_CONFIG_FILE);
  -            if (!configFile.exists()) {
  -                InputStream is = ctx.getResourceAsStream(appWebInfPath + "/" + 
SERVER_CONFIG_FILE);
  -                if (is != null) {
  -                    // FileProvider assumes responsibility for 'is':
  -                    // do NOT call is.close().
  -                    config = new FileProvider(is);
  -                }
  -    
  -                if (config == null) {
  -                    log.error(Messages.getMessage("servletEngineWebInfError01",
  -                                                   configFile.toString()));
  -                }
  +
  +        /**
  +         * If path/file doesn't exist, it may still be accessible
  +         * as a resource-stream (i.e. it may be packaged in a JAR
  +         * or WAR file).
  +         */
  +        if (realWebInfPath == null  ||
  +            !(new File(realWebInfPath, SERVER_CONFIG_FILE)).exists())
  +        {
  +            String name = appWebInfPath + "/" + SERVER_CONFIG_FILE;
  +            InputStream is = ctx.getResourceAsStream(name);
  +            if (is != null) {
  +                // FileProvider assumes responsibility for 'is':
  +                // do NOT call is.close().
  +                config = new FileProvider(is);
  +            }
  +
  +            if (config == null) {
  +                log.error(Messages.getMessage("servletEngineWebInfError01",
  +                                               name));
               }
           }
           
  -        if (config == null) {
  +        /**
  +         * Couldn't get data  OR  file does exist.
  +         * If we have a path, then attempt to either open
  +         * the existing file, or create an (empty) file.
  +         */
  +        if (config == null  &&  realWebInfPath != null) {
               try {
                   config = new FileProvider(realWebInfPath, SERVER_CONFIG_FILE);
               } catch (ConfigurationException e) {
  @@ -193,6 +204,9 @@
               }
           }
   
  +        /**
  +         * Fall back to config file packaged with AxisEngine
  +         */
           if (config == null) {
               log.warn(Messages.getMessage("servletEngineWebInfWarn00"));
               try {
  
  
  
  1.10      +31 -9     
xml-axis/java/src/org/apache/axis/server/JNDIAxisServerFactory.java
  
  Index: JNDIAxisServerFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/server/JNDIAxisServerFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JNDIAxisServerFactory.java        18 Sep 2002 16:10:39 -0000      1.9
  +++ JNDIAxisServerFactory.java        27 Sep 2002 15:32:02 -0000      1.10
  @@ -130,21 +130,43 @@
                   
               // THIS IS NOT ACCEPTABLE JNDI NAMING...
               String name = servletContext.getRealPath("/WEB-INF/Server");
  +
  +// The following was submitted as a patch, but I don't believe this
  +// is going to produce a valid JNDI name of ANY sort... yuck.
  +// This would produce a URL, not a path name.
  +//
  +// Since it appears, from comments above, that this entire scheme is
  +// broken, then for now I'll simply check for a null-name to prevent
  +// possible NPE on WebLogic.
  +//
  +// What ARE we doing here?!?!
  +//            
  +//            if (name == null) {
  +//                try {
  +//                    name = 
servletContext.getResource("/WEB-INF/Server").toString();
  +//                } catch (Exception e) {
  +//                    // ignore
  +//                }
  +//            }
                   
               // We've got JNDI, so try to find an AxisServer at the
               // specified name.
  -            try {
  -                server = (AxisServer)context.lookup(name);
  -            } catch (NamingException e) {
  -                // Didn't find it.
  -                server = super.getServer(environment);
  +            if (name != null) {
                   try {
  -                    context.bind(name, server);
  -                } catch (NamingException e1) {
  -                    // !!! Couldn't do it, what should we do here?
  +                    server = (AxisServer)context.lookup(name);
  +                } catch (NamingException e) {
  +                    // Didn't find it.
  +                    server = super.getServer(environment);
  +                    try {
  +                        context.bind(name, server);
  +                    } catch (NamingException e1) {
  +                        // !!! Couldn't do it, what should we do here?
  +                    }
                   }
               }
  -        } else {
  +        }
  +        
  +        if (server == null) {
               server = super.getServer(environment);
           }
   
  
  
  


Reply via email to