You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/02/02 18:55:08 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappLoader.java

remm        02/02/02 09:55:08

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappLoader.java
  Log:
  - Attempt to fix the (very complex) bug 5201.
  - Bind the CCL to the webapp ClassLoader during the start of the context's children
    and subcomponents.
  - Also add some commented out code granting permissions to the webapp codebases
    to read/write its work directory. Glenn: This grants the permissions mandated in the
    spec, so I'd really like to add them.
  
  Revision  Changes    Path
  1.23      +26 -7     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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- WebappLoader.java	4 Jan 2002 17:09:08 -0000	1.22
  +++ WebappLoader.java	2 Feb 2002 17:55:08 -0000	1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v 1.22 2002/01/04 17:09:08 remm Exp $
  - * $Revision: 1.22 $
  - * $Date: 2002/01/04 17:09:08 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v 1.23 2002/02/02 17:55:08 remm Exp $
  + * $Revision: 1.23 $
  + * $Date: 2002/02/02 17:55:08 $
    *
    * ====================================================================
    *
  @@ -72,11 +72,13 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.FileOutputStream;
  +import java.io.FilePermission;
   import java.io.OutputStream;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.net.URLStreamHandlerFactory;
  +import java.security.Permission;
   import java.util.jar.JarFile;
   import javax.servlet.ServletContext;
   import javax.naming.NamingException;
  @@ -115,7 +117,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.22 $ $Date: 2002/01/04 17:09:08 $
  + * @version $Revision: 1.23 $ $Date: 2002/02/02 17:55:08 $
    */
   
   public class WebappLoader
  @@ -644,6 +646,8 @@
               DirContextURLStreamHandler.bind
                   ((ClassLoader) classLoader, this.container.getResources());
   
  +            Thread.currentThread().setContextClassLoader(classLoader);
  +
           } catch (Throwable t) {
               throw new LifecycleException("start: ", t);
           }
  @@ -808,6 +812,24 @@
           ServletContext servletContext =
               ((Context) container).getServletContext();
   
  +        // Assigning permissions for the work directory
  +        File workDir =
  +            (File) servletContext.getAttribute(Globals.WORK_DIR_ATTR);
  +        if (workDir != null) {
  +            /*
  +            try {
  +                String workDirPath = workDir.getCanonicalPath();
  +                classLoader.addPermission
  +                    (new FilePermission(workDirPath, "read,write"));
  +                classLoader.addPermission
  +                    (new FilePermission(workDirPath + File.separator + "-", 
  +                                        "read,write,delete"));
  +            } catch (IOException e) {
  +                // Ignore
  +            }
  +            */
  +        }
  +
           try {
   
               URL rootURL = servletContext.getResource("/");
  @@ -851,9 +873,6 @@
   
               } else {
   
  -                File workDir =
  -                    (File) servletContext.getAttribute
  -                    (Globals.WORK_DIR_ATTR);
                   if (workDir != null) {
                       if (libURL != null) {
                           File libDir = new File(workDir, "WEB-INF/lib/");
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>