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...@locus.apache.org on 2000/10/10 19:21:54 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

remm        00/10/10 10:21:50

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java WebdavServlet.java
  Log:
  - Fixes JSP inclusion problem : The DefaultServlet was closing the
    OS / Writer after processing the request.
  
  Revision  Changes    Path
  1.10      +9 -75     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultServlet.java	2000/10/10 02:17:33	1.9
  +++ DefaultServlet.java	2000/10/10 17:21:39	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v 1.9 2000/10/10 02:17:33 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/10/10 02:17:33 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v 1.10 2000/10/10 17:21:39 remm Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/10/10 17:21:39 $
    *
    * ====================================================================
    *
  @@ -112,7 +112,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.9 $ $Date: 2000/10/10 02:17:33 $
  + * @version $Revision: 1.10 $ $Date: 2000/10/10 17:21:39 $
    */
   
   public class DefaultServlet
  @@ -657,24 +657,13 @@
           // Copy the input stream to the output stream
           exception = copyRange(istream, ostream);
           
  -        // Clean up the input and output streams
  +        // Clean up the input stream
           try {
               istream.close();
           } catch (Throwable t) {
               ;
           }
           
  -	try {
  -	    ostream.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    ostream.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -
   	// Rethrow any exception that has occurred
   	if (exception != null)
   	    throw exception;
  @@ -705,24 +694,13 @@
           // Copy the input stream to the output stream
           exception = copyRange(reader, writer);
           
  -        // Clean up the input and output streams
  +        // Clean up the reader
           try {
               reader.close();
           } catch (Throwable t) {
               ;
           }
           
  -	try {
  -	    writer.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    writer.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -
   	// Rethrow any exception that has occurred
   	if (exception != null)
   	    throw exception;
  @@ -752,22 +730,12 @@
               new BufferedInputStream(resourceInputStream, input);
           exception = copyRange(istream, ostream, range.start, range.end);
           
  -	// Clean up the input and output streams
  +	// Clean up the input stream
   	try {
   	    istream.close();
   	} catch (Throwable t) {
   	    ;
   	}
  -	try {
  -	    ostream.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    ostream.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
   
   	// Rethrow any exception that has occurred
   	if (exception != null)
  @@ -797,22 +765,12 @@
           Reader reader = new InputStreamReader(resourceInputStream);
           exception = copyRange(reader, writer, range.start, range.end);
           
  -	// Clean up the input and output streams
  +	// Clean up the input stream
   	try {
   	    reader.close();
   	} catch (Throwable t) {
   	    ;
   	}
  -	try {
  -	    writer.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    writer.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
   
   	// Rethrow any exception that has occurred
   	if (exception != null)
  @@ -870,19 +828,7 @@
           
           ostream.print("--" + mimeSeparation + "--");
           
  -	// Clean up the output streams
  -	try {
  -	    ostream.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    ostream.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -
  -	// Rethrow any exception that has occurred
  +        // Rethrow any exception that has occurred
   	if (exception != null)
   	    throw exception;
           
  @@ -937,18 +883,6 @@
           
           writer.print("--" + mimeSeparation + "--");
           
  -	// Clean up the output streams
  -	try {
  -	    writer.flush();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -	try {
  -	    writer.close();
  -	} catch (Throwable t) {
  -	    ;
  -	}
  -
   	// Rethrow any exception that has occurred
   	if (exception != null)
   	    throw exception;
  
  
  
  1.4       +7 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
  
  Index: WebdavServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebdavServlet.java	2000/10/07 18:32:40	1.3
  +++ WebdavServlet.java	2000/10/10 17:21:41	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java,v 1.3 2000/10/07 18:32:40 remm Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/10/07 18:32:40 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java,v 1.4 2000/10/10 17:21:41 remm Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/10/10 17:21:41 $
    *
    * ====================================================================
    *
  @@ -120,7 +120,7 @@
    * are handled by the DefaultServlet.
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.3 $ $Date: 2000/10/07 18:32:40 $
  + * @version $Revision: 1.4 $ $Date: 2000/10/10 17:21:41 $
    */
   
   public class WebdavServlet
  @@ -1378,7 +1378,9 @@
                       .substring(servletPath.length());
               }
           }
  -        System.out.println("Dest path :" + destinationPath);
  +        
  +        if (debug > 0)
  +            System.out.println("Dest path :" + destinationPath);
           
           String path = getRelativePath(req);