remm        01/06/23 15:30:05

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappLoader.java
  Log:
  - Don't copy the JARs to the work directory if filesystem based.
  
  Revision  Changes    Path
  1.7       +34 -20    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebappLoader.java 2001/06/21 01:39:08     1.6
  +++ WebappLoader.java 2001/06/23 22:30:04     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
 1.6 2001/06/21 01:39:08 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/06/21 01:39:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
 1.7 2001/06/23 22:30:04 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/06/23 22:30:04 $
    *
    * ====================================================================
    *
  @@ -119,7 +119,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.6 $ $Date: 2001/06/21 01:39:08 $
  + * @version $Revision: 1.7 $ $Date: 2001/06/23 22:30:04 $
    */
   
   public class WebappLoader
  @@ -608,12 +608,13 @@
   
        // Construct a class loader based on our current repositories list
        try {
  -         if (parentClassLoader == null)
  -             classLoader = new WebappClassLoader(container.getResources());
  -         else
  -             classLoader = new WebappClassLoader
  -                    (parentClassLoader, container.getResources());
   
  +            if (parentClassLoader == null) {
  +                classLoader = new WebappClassLoader(container.getResources());
  +            } else {
  +                classLoader = new WebappClassLoader
  +                    (parentClassLoader, container.getResources());
  +            }
               classLoader.setDebug(this.debug);
               classLoader.setDelegate(this.delegate);
   
  @@ -907,8 +908,18 @@
           
           if (libDir != null) {
               
  -            File destDir = new File(workDir, libPath);
  -            destDir.mkdirs();
  +            boolean copyJars = false;
  +            String absoluteLibPath = servletContext.getRealPath(libPath);
  +
  +            File destDir = null;
  +
  +            if (absoluteLibPath != null) {
  +                destDir = new File(absoluteLibPath);
  +            } else {
  +                copyJars = true;
  +                destDir = new File(workDir, libPath);
  +                destDir.mkdirs();
  +            }
               
               // Looking up directory /WEB-INF/lib in the context
               try {
  @@ -929,18 +940,21 @@
                                        destFile.getAbsolutePath()));
                       
                       Resource jarResource = (Resource) binding.getObject();
  -                    if (copy(jarResource.streamContent(), 
  -                             new FileOutputStream(destFile))) {
  -                        if (classpath.length() != 0)
  -                            classpath.append(File.pathSeparator);
  -                        classpath.append(destFile.getAbsolutePath());
  +                    if (copyJars) {
  +                        if (!copy(jarResource.streamContent(), 
  +                                  new FileOutputStream(destFile)))
  +                            continue;
                       }
  -                    
  +
  +                    if (classpath.length() != 0)
  +                        classpath.append(File.pathSeparator);
  +                    classpath.append(destFile.getAbsolutePath());
  +
                       JarFile jarFile = new JarFile(destFile);
  -                    
  +
                       classLoader.addJar(filename, jarFile, destFile);
                       addRepository(filename);
  -                    
  +
                   }
               } catch (NamingException e) {
                   // Silent catch: it's valid that no /WEB-INF/lib directory 
  @@ -1255,7 +1269,7 @@
        */
       public void run() {
   
  -     context.reload();
  +        context.reload();
   
       }
   
  
  
  

Reply via email to