tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets DefaultServlet.java
Date Fri, 18 Aug 2000 07:47:40 GMT
remm        00/08/18 00:47:39

  Modified:    proposals/catalina/src/share/org/apache/tomcat/resources
                        DirectoryBean.java
               proposals/catalina/src/share/org/apache/tomcat/servlets
                        DefaultServlet.java
  Log:
  - Forgot to call the RequestDispatcher for the handling of welcome files (so
    that the source of an index.jsp page was displayed). Should be fixed now.
  - Cosmetic issue in the directory browser.
  
  Revision  Changes    Path
  1.5       +7 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/DirectoryBean.java
  
  Index: DirectoryBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/DirectoryBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DirectoryBean.java	2000/08/01 02:41:21	1.4
  +++ DirectoryBean.java	2000/08/18 07:47:34	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/DirectoryBean.java,v
1.4 2000/08/01 02:41:21 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/08/01 02:41:21 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/DirectoryBean.java,v
1.5 2000/08/18 07:47:34 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/08/18 07:47:34 $
    *
    * ====================================================================
    *
  @@ -91,7 +91,7 @@
    * manner.  No internal synchronization is performed.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/08/01 02:41:21 $
  + * @version $Revision: 1.5 $ $Date: 2000/08/18 07:47:34 $
    */
   
   public final class DirectoryBean extends ResourceBean {
  @@ -229,7 +229,9 @@
       public InputStream render(String contextPath) {
   
   	// Number of characters to trim from the beginnings of filenames
  -	int trim = name.length() + 1;
  +	int trim = name.length();
  +        if (!name.endsWith("/"))
  +            trim += 1;
   	if (name.equals("/"))
   	    trim = 1;
   
  
  
  
  1.22      +16 -9     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultServlet.java	2000/08/07 02:30:13	1.21
  +++ DefaultServlet.java	2000/08/18 07:47:36	1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.21 2000/08/07 02:30:13 remm Exp $
  - * $Revision: 1.21 $
  - * $Date: 2000/08/07 02:30:13 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.22 2000/08/18 07:47:36 remm Exp $
  + * $Revision: 1.22 $
  + * $Date: 2000/08/18 07:47:36 $
    *
    * ====================================================================
    *
  @@ -108,7 +108,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.21 $ $Date: 2000/08/07 02:30:13 $
  + * @version $Revision: 1.22 $ $Date: 2000/08/18 07:47:36 $
    */
   
   public class DefaultServlet
  @@ -967,16 +967,23 @@
           // If the resource is a collection (aka a directory), we check 
           // the welcome files list.
           if (resourceInfo.collection) {
  +            
  +            if (!path.endsWith("/")) {
  +                response.sendRedirect(request.getRequestURI() + "/");
  +                return;
  +            }
               ResourceInfo welcomeFileInfo = checkWelcomeFiles(path, resources);
               if (welcomeFileInfo != null) {
                   resourceInfo = welcomeFileInfo;
  +                RequestDispatcher rd =
  +                    getServletContext().getRequestDispatcher
  +                    (resourceInfo.path);
  +                if (rd != null) {
  +                    rd.forward(request, response);
  +                    return;
  +                }
               }
               
  -            if ((welcomeFileInfo != null) && 
  -                (!path.endsWith("/"))) {
  -                response.sendRedirect(request.getRequestURI() + "/");
  -                return;
  -            }
               
           }
           
  
  
  

Mime
View raw message