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 2003/06/13 00:06:30 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java

remm        2003/06/12 15:06:30

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java
  Log:
  - Use regular file URLs with everything from /WEB-INF/lib.
  - I'm not sure this is useful, and will be reverted to rev 1.12 otherwise.
  
  Revision  Changes    Path
  1.13      +32 -15    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ApplicationContext.java	21 May 2003 17:49:03 -0000	1.12
  +++ ApplicationContext.java	12 Jun 2003 22:06:30 -0000	1.13
  @@ -526,19 +526,36 @@
           if (path == null)
               return (null);
   
  -        DirContext resources = context.getResources();
  -        if (resources != null) {
  -            String fullPath = context.getName() + path;
  -            String hostName = context.getParent().getName();
  -            try {
  -                resources.lookup(path);
  -                return new URL
  -                    ("jndi", null, 0, getJNDIUri(hostName, fullPath),
  -                     new DirContextURLStreamHandler(resources));
  -            } catch (Exception e) {
  -                //e.printStackTrace();
  +        String libPath = "/WEB-INF/lib/";
  +        if ((path.startsWith(libPath)) && (path.endsWith(".jar"))) {
  +            File jarFile = null;
  +            if (context.isFilesystemBased()) {
  +                jarFile = new File(basePath, path);
  +            } else {
  +                jarFile = new File(context.getWorkDir(), path);
  +            }
  +            if (jarFile.exists()) {
  +                return jarFile.toURL();
  +            } else {
  +                return null;
  +            }
  +        } else {
  +
  +            DirContext resources = context.getResources();
  +            if (resources != null) {
  +                String fullPath = context.getName() + path;
  +                String hostName = context.getParent().getName();
  +                try {
  +                    resources.lookup(path);
  +                    return new URL
  +                        ("jndi", null, 0, getJNDIUri(hostName, fullPath),
  +                         new DirContextURLStreamHandler(resources));
  +                } catch (Exception e) {
  +                    // Ignore
  +                }
               }
           }
  +
           return (null);
   
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org