Author: markt
Date: Thu Nov 30 10:20:02 2017
New Revision: 1816696

URL: http://svn.apache.org/viewvc?rev=1816696&view=rev
Log:
Refactoring: HTTP/1.1 - HTTP/2 alignment

Pull up end() method from OutputFilter to OutputBuffer

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/HttpOutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java
    tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1816696&r1=1816695&r2=1816696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Nov 
30 10:20:02 2017
@@ -276,12 +276,8 @@ public class Http11OutputBuffer implemen
     }
 
 
-    /**
-     * Finish writing the response.
-     *
-     * @throws IOException an underlying I/O error occurred
-     */
-    public void finishResponse() throws IOException {
+    @Override
+    public void end() throws IOException {
         if (responseFinished) {
             return;
         }
@@ -290,7 +286,7 @@ public class Http11OutputBuffer implemen
             activeFilters[lastActiveFilter].end();
         }
 
-        flushBuffer(true);
+        outputStreamOutputBuffer.end();
 
         responseFinished = true;
     }
@@ -562,5 +558,10 @@ public class Http11OutputBuffer implemen
         public long getBytesWritten() {
             return byteCount;
         }
+
+        @Override
+        public void end() throws IOException {
+            socketWrapper.flush(true);
+        }
     }
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1816696&r1=1816695&r2=1816696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Thu Nov 30 
10:20:02 2017
@@ -1141,7 +1141,7 @@ public class Http11Processor extends Abs
         if (getErrorState().isIoAllowed()) {
             try {
                 action(ActionCode.COMMIT, null);
-                outputBuffer.finishResponse();
+                outputBuffer.end();
             } catch (IOException e) {
                 setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
             } catch (Throwable t) {
@@ -1155,7 +1155,7 @@ public class Http11Processor extends Abs
 
     @Override
     protected final void finishResponse() throws IOException {
-        outputBuffer.finishResponse();
+        outputBuffer.end();
     }
 
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/HttpOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/HttpOutputBuffer.java?rev=1816696&r1=1816695&r2=1816696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/HttpOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/HttpOutputBuffer.java Thu Nov 30 
10:20:02 2017
@@ -16,8 +16,18 @@
  */
 package org.apache.coyote.http11;
 
+import java.io.IOException;
+
 import org.apache.coyote.OutputBuffer;
 
 public interface HttpOutputBuffer extends OutputBuffer {
 
+    /**
+     * Finish writing the current response. It is acceptable to write extra
+     * bytes using {@link #doWrite(java.nio.ByteBuffer)} during the execution 
of
+     * this method.
+     *
+     * @throws IOException If an I/O error occurs while writing to the client
+     */
+    public void end() throws IOException;
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java?rev=1816696&r1=1816695&r2=1816696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java Thu Nov 30 
10:20:02 2017
@@ -16,8 +16,6 @@
  */
 package org.apache.coyote.http11;
 
-import java.io.IOException;
-
 import org.apache.coyote.Response;
 
 /**
@@ -49,13 +47,4 @@ public interface OutputFilter extends Ht
      * @param buffer The next buffer instance
      */
     public void setBuffer(HttpOutputBuffer buffer);
-
-
-    /**
-     * End the current request. It is acceptable to write extra bytes using
-     * buffer.doWrite during the execution of this method.
-     *
-     * @throws IOException If an I/O error occurs while writing to the client
-     */
-    public void end() throws IOException;
 }

Modified: 
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java?rev=1816696&r1=1816695&r2=1816696&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
Thu Nov 30 10:20:02 2017
@@ -113,5 +113,10 @@ public class TesterOutputBuffer extends
         public long getBytesWritten() {
             return byteCount;
         }
+
+        @Override
+        public void end() throws IOException {
+            // NO-OP: Unused
+        }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to