remm        02/03/08 16:15:40

  Modified:    coyote/src/java/org/apache/coyote/tomcat4 OutputBuffer.java
  Log:
  - Add an experimental trick to implement the spec requirement that the content
    length be calculated automatically if the entire response fits in the buffer
    (and the response is closed without flushing first). This appears to be working
    with the Hello world servlet.
  
  Revision  Changes    Path
  1.4       +10 -0     
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OutputBuffer.java 8 Mar 2002 05:18:29 -0000       1.3
  +++ OutputBuffer.java 9 Mar 2002 00:15:40 -0000       1.4
  @@ -137,6 +137,7 @@
   
       private boolean suspended = false;
   
  +    private boolean knownResponseSize = false;
   
       // ----------------------------------------------------------- Constructors
   
  @@ -225,12 +226,18 @@
           gotEnc = false;
           enc = null;
   
  +        knownResponseSize = false;
  +
       }
   
   
       public void close()
           throws IOException {
   
  +        if (!coyoteResponse.isCommitted()) {
  +            knownResponseSize = true;
  +        }
  +
           flush();
           closed = true;
   
  @@ -273,6 +280,9 @@
               return;
           if (coyoteResponse == null)
               return;
  +
  +        if (knownResponseSize)
  +            coyoteResponse.setContentLength(cnt);
   
           // If we really have something to write
           if (cnt > 0) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to