You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ja...@apache.org on 2003/11/08 09:02:11 UTC

cvs commit: incubator-geronimo/modules/web/src/java/org/apache/geronimo/web AbstractWebContainer.java

janb        2003/11/08 00:02:10

  Modified:    modules/web/src/java/org/apache/geronimo/web
                        AbstractWebContainer.java
  Log:
  Support deployment of exploded wars so that it works with the current FileScanner strategy.
  
  Revision  Changes    Path
  1.12      +34 -1     incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java
  
  Index: AbstractWebContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractWebContainer.java	30 Oct 2003 07:47:05 -0000	1.11
  +++ AbstractWebContainer.java	8 Nov 2003 08:02:10 -0000	1.12
  @@ -56,8 +56,10 @@
   
   package org.apache.geronimo.web;
   
  +import java.io.File;
   import java.io.InputStream;
   import java.io.IOException;
  +import java.net.MalformedURLException;
   import java.net.URI;
   import java.net.URL;
   import java.util.ArrayList;
  @@ -387,6 +389,37 @@
                       throw new DeploymentException( "Failed to close stream for URL: " + url, iox);
                   }
               }
  +        }
  +        else if (type == URLType.RESOURCE)
  +        {
  +            //we will try and deploy a WEB-INF/web.xml by looking for the parent directory 
  +             if (!url.getPath().endsWith("web.xml"))
  +                 return false;
  +
  +            try
  +            {
  +                File file = new File (url.toExternalForm());
  +                
  +                if (!file.exists())
  +                    throw new DeploymentException ("No such file:"+url);
  +                    
  +                File parent = file.getParentFile();
  +                if (!parent.getName().equals("WEB-INF"))
  +                    throw new DeploymentException ("web.xml must be in WEB-INF directory");
  +                
  +                // find the parent dir of WEB-INF and try to deploy that    
  +                parent = parent.getParentFile();         
  +                url = parent.toURL();
  +            }
  +            catch (NullPointerException e)
  +            {
  +                 throw new DeploymentException ("No path to web.xml file", e);       
  +            }
  +            catch (MalformedURLException e)
  +            {
  +                throw new DeploymentException ("Bad url for possible webapp directory", e);
  +            }
  +            
           }
           else
           {