tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java
Date Sat, 03 Feb 2001 07:48:33 GMT
remm        01/02/02 23:48:33

  Modified:    catalina/src/share/org/apache/catalina/connector
                        HttpResponseBase.java
               catalina/src/share/org/apache/catalina/connector/http
                        HttpResponseImpl.java
               catalina/src/share/org/apache/catalina/core
                        StandardWrapperValve.java
               catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  - Will now return a status report for every status except 304 (and 200).
  - Now try to emulate Apache 1.3.x behavior as closely as possible.
  - Don't add a Content-Length: 0 when status is 304.
  - The directory browsing pages will now return links to other directories with
    a trailing "/" to minimize the number of redirections needed.
  
  Revision  Changes    Path
  1.26      +6 -6      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HttpResponseBase.java	2001/01/26 21:33:12	1.25
  +++ HttpResponseBase.java	2001/02/03 07:48:31	1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
1.25 2001/01/26 21:33:12 craigmcc Exp $
  - * $Revision: 1.25 $
  - * $Date: 2001/01/26 21:33:12 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
1.26 2001/02/03 07:48:31 remm Exp $
  + * $Revision: 1.26 $
  + * $Date: 2001/02/03 07:48:31 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.25 $ $Date: 2001/01/26 21:33:12 $
  + * @version $Revision: 1.26 $ $Date: 2001/02/03 07:48:31 $
    */
   
   public class HttpResponseBase
  @@ -1043,8 +1043,8 @@
   	String absolute = toAbsolute(location);
   	setStatus(SC_MOVED_TEMPORARILY);
   	setHeader("Location", absolute);
  -        setContentLength(0);
  -	flushBuffer();
  +        //setContentLength(0);
  +	//flushBuffer();
   
       }
   
  
  
  
  1.7       +6 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java
  
  Index: HttpResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HttpResponseImpl.java	2000/11/22 02:29:52	1.6
  +++ HttpResponseImpl.java	2001/02/03 07:48:32	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v
1.6 2000/11/22 02:29:52 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/11/22 02:29:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v
1.7 2001/02/03 07:48:32 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/02/03 07:48:32 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    *
    * @author Craig R. McClanahan
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.6 $ $Date: 2000/11/22 02:29:52 $
  + * @version $Revision: 1.7 $ $Date: 2001/02/03 07:48:32 $
    */
   
   final class HttpResponseImpl
  @@ -263,7 +263,8 @@
        */
       public void finishResponse() throws IOException {
   
  -        if ((!isStreamInitialized()) && (getContentLength() == -1))
  +        if ((!isStreamInitialized()) && (getContentLength() == -1)
  +            && (getStatus() != SC_NOT_MODIFIED))
               setContentLength(0);
           super.finishResponse();
   
  
  
  
  1.17      +8 -7      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- StandardWrapperValve.java	2001/01/23 02:51:16	1.16
  +++ StandardWrapperValve.java	2001/02/03 07:48:33	1.17
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
1.16 2001/01/23 02:51:16 craigmcc Exp $
  - * $Revision: 1.16 $
  - * $Date: 2001/01/23 02:51:16 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
1.17 2001/02/03 07:48:33 remm Exp $
  + * $Revision: 1.17 $
  + * $Date: 2001/02/03 07:48:33 $
    *
    * ====================================================================
    *
  @@ -102,7 +102,7 @@
    * <code>StandardWrapper</code> container implementation.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.16 $ $Date: 2001/01/23 02:51:16 $
  + * @version $Revision: 1.17 $ $Date: 2001/02/03 07:48:33 $
    */
   
   final class StandardWrapperValve
  @@ -775,8 +775,9 @@
   	// Do nothing on an OK status
   	if (statusCode == HttpServletResponse.SC_OK)
   	    return;
  -        if (statusCode < 400)
  -            return;
  +	// Do nothing on a NO MODIFIED status
  +	if (statusCode == HttpServletResponse.SC_NOT_MODIFIED)
  +	    return;
   
   	// Handle a custom error page for this status code
   	Context context = (Context) container.getParent();
  @@ -812,7 +813,7 @@
   	// Render a default HTML status report page
   	try {
   	    try {
  -		hres.setContentType("text/html");
  +		hres.setContentType("text/html; charset=UTF-8");
   	    } catch (Throwable t) {
                   if (debug >= 1)
                       log("status.setContentType", t);
  
  
  
  1.26      +10 -12    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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DefaultServlet.java	2001/02/01 04:29:57	1.25
  +++ DefaultServlet.java	2001/02/03 07:48:33	1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.25 2001/02/01 04:29:57 remm Exp $
  - * $Revision: 1.25 $
  - * $Date: 2001/02/01 04:29:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.26 2001/02/03 07:48:33 remm Exp $
  + * $Revision: 1.26 $
  + * $Date: 2001/02/03 07:48:33 $
    *
    * ====================================================================
    *
  @@ -122,7 +122,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.25 $ $Date: 2001/02/01 04:29:57 $
  + * @version $Revision: 1.26 $ $Date: 2001/02/03 07:48:33 $
    */
   
   public class DefaultServlet
  @@ -738,8 +738,7 @@
                       && (lastModified <= (date.getTime() + 1000)) ) {
                       // The entity has not been modified since the date 
                       // specified by the client. This is not an error case.
  -                    response.sendError
  -                        (HttpServletResponse.SC_NOT_MODIFIED);
  +                    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                       return false;
                   }
                   
  @@ -775,8 +774,7 @@
                   // back.
                   if ( ("GET".equals(request.getMethod()))
                        || ("HEAD".equals(request.getMethod())) ) {
  -                    response.sendError
  -                        (HttpServletResponse.SC_NOT_MODIFIED);
  +                    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                       return false;
                   } else {
                       response.sendError
  @@ -1846,8 +1844,6 @@
           }
           PrintWriter writer = new PrintWriter(osWriter);
   
  -	// FIXME - Currently pays no attention to the user's Locale
  -
   	// Render the page header
   	writer.print("<html>\r\n");
   	writer.print("<head>\r\n");
  @@ -1877,9 +1873,9 @@
   	    writer.print(rewriteUrl(contextPath));
               if (parent.equals(""))
                   parent = "/";
  -            //if (contextPath.endsWith("/"))
  -            //parent = parent.substring(1);
   	    writer.print(rewriteUrl(parent));
  +            if (!parent.endsWith("/"))
  +                writer.print("/");
               writer.print("\">");
   	    writer.print(sm.getString("directory.parent", parent));
   	    writer.print("</a>\r\n");
  @@ -1929,6 +1925,8 @@
                   writer.print(rewriteUrl(contextPath));
                   resourceName = rewriteUrl(name + resourceName);
                   writer.print(resourceName);
  +                if (childResourceInfo.collection)
  +                    writer.print("/");
                   writer.print("\"><tt>");
                   writer.print(trimmed);
   
  
  
  

Mime
View raw message