remm        01/09/10 18:34:50

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java
  Log:
  - The URLs returned had extra '/' in many cases.
  
  Revision  Changes    Path
  1.32      +20 -9     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ApplicationContext.java   2001/09/10 15:21:02     1.31
  +++ ApplicationContext.java   2001/09/11 01:34:50     1.32
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.31 2001/09/10 15:21:02 glenn Exp $
  - * $Revision: 1.31 $
  - * $Date: 2001/09/10 15:21:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.32 2001/09/11 01:34:50 remm Exp $
  + * $Revision: 1.32 $
  + * $Date: 2001/09/11 01:34:50 $
    *
    * ====================================================================
    *
  @@ -113,7 +113,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.31 $ $Date: 2001/09/10 15:21:02 $
  + * @version $Revision: 1.32 $ $Date: 2001/09/11 01:34:50 $
    */
   
   public class ApplicationContext
  @@ -172,8 +172,8 @@
           }
   
           public Object run() throws Exception {
  -            return new URL("jndi", null, 0, "/" + host + "/" + path,
  -                   new DirContextURLStreamHandler(resources));
  +            return new URL("jndi", null, 0, getJNDIUri(host, path),
  +                           new DirContextURLStreamHandler(resources));
           }
       }
   
  @@ -640,9 +640,9 @@
                           throw pe.getException();
                       }
                   } else {
  -                    return new URL("jndi", null, 0,
  -                                   "/" + hostName + "/" + fullPath,
  -                                   new DirContextURLStreamHandler(resources));
  +                    return new URL
  +                        ("jndi", null, 0, getJNDIUri(hostName, fullPath),
  +                         new DirContextURLStreamHandler(resources));
                   }
               } catch (Exception e) {
                   //e.printStackTrace();
  @@ -1073,6 +1073,17 @@
               set.add(childPath.toString());
           }
   
  +    }
  +
  +
  +    /**
  +     * Get full path, based on the host name and the context path.
  +     */
  +    public static String getJNDIUri(String hostName, String path) {
  +        if (!path.startsWith("/"))
  +            return "/" + hostName + "/" + path;
  +        else
  +            return "/" + hostName + path;
       }
   
   
  
  
  

Reply via email to