remm        01/01/12 21:20:05

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java LocalStrings.properties
  Log:
  - Fix lots of path related problems.
  - Directory browser works again.
  - The only known issues are :
    - writing, which will fail because of functions which are not implemented yet
      in the FileDirContext.
    - accessing encoded URLs fail (like files with spaces in their names.
  - WebDAV is broken at the moment, and needs a small revision of the
    algorithms.
  
  Revision  Changes    Path
  1.20      +11 -19    
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultServlet.java       2001/01/12 06:55:34     1.19
  +++ DefaultServlet.java       2001/01/13 05:20:05     1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.19 2001/01/12 06:55:34 remm Exp $
  - * $Revision: 1.19 $
  - * $Date: 2001/01/12 06:55:34 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
 1.20 2001/01/13 05:20:05 remm Exp $
  + * $Revision: 1.20 $
  + * $Date: 2001/01/13 05:20:05 $
    *
    * ====================================================================
    *
  @@ -118,7 +118,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.19 $ $Date: 2001/01/12 06:55:34 $
  + * @version $Revision: 1.20 $ $Date: 2001/01/13 05:20:05 $
    */
   
   public class DefaultServlet
  @@ -1439,12 +1439,6 @@
               
           }
           
  -     if (!resourceInfo.exists()) {
  -         response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  -                               resourceInfo.path);
  -         return;
  -     }
  -
           // Checking If headers
           if ( !checkIfHeaders(request, response, resourceInfo) ) {
               return;
  @@ -1525,7 +1519,8 @@
                   
                   if (content) {
                       // Serve the directory browser
  -                    resourceInfo.is = render(resourceInfo);
  +                    resourceInfo.is = 
  +                        render(request.getContextPath(), resourceInfo);
                   }
                   
               }
  @@ -1738,9 +1733,8 @@
        * @param contextPath Context path to which our internal paths are
        *  relative
        */
  -    public InputStream render(ResourceInfo resourceInfo) {
  +    public InputStream render(String contextPath, ResourceInfo resourceInfo) {
   
  -        String contextPath = resourceInfo.path;
           String name = resourceInfo.path;
   
        // Number of characters to trim from the beginnings of filenames
  @@ -1785,8 +1779,8 @@
            writer.print(rewriteUrl(contextPath));
               if (parent.equals(""))
                   parent = "/";
  -            if (contextPath.endsWith("/"))
  -                parent = parent.substring(1);
  +            //if (contextPath.endsWith("/"))
  +            //parent = parent.substring(1);
            writer.print(parent);
            writer.print("\">");
            writer.print(sm.getString("directory.parent", parent));
  @@ -1821,7 +1815,7 @@
                   ResourceInfo childResourceInfo = 
                       new ResourceInfo(resourceName, directory);
   
  -                String trimmed = resourceName.substring(trim);
  +                String trimmed = resourceName/*.substring(trim)*/;
                   if (trimmed.equalsIgnoreCase("WEB-INF") ||
                       trimmed.equalsIgnoreCase("META-INF"))
                       continue;
  @@ -1835,9 +1829,7 @@
                   writer.print("<td align=\"left\">&nbsp;&nbsp;\r\n");
                   writer.print("<a href=\"");
                   writer.print(rewriteUrl(contextPath));
  -                resourceName = rewriteUrl(resourceName);
  -                if ((contextPath.endsWith("/")) && (resourceName.length() > 0))
  -                    resourceName = resourceName.substring(1);
  +                resourceName = rewriteUrl(name + resourceName);
                   writer.print(resourceName);
                   writer.print("\"><tt>");
                   writer.print(trimmed);
  
  
  
  1.4       +6 -0      
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties   2000/11/10 01:19:17     1.3
  +++ LocalStrings.properties   2001/01/13 05:20:05     1.4
  @@ -19,3 +19,9 @@
   managerServlet.reloaded=OK - Reloaded application at context path {0}
   managerServlet.undeployed=OK - Undeployed application at context path {0}
   webdavservlet.jaxpfailed=JAXP initialization failed
  +directory.filename=Filename
  +directory.lastModified=Last Modified
  +directory.parent=Up To {0}
  +directory.size=Size
  +directory.title=Directory Listing For {0}
  +directory.version=Tomcat Catalina version 4.1
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to