Author: markt
Date: Tue Nov 28 11:38:48 2017
New Revision: 1816538

URL: http://svn.apache.org/viewvc?rev=1816538&view=rev
Log:
Refactoring (with a longer term aim of aligning HTTP/1.1 and HTTP/2 to enable 
reuse)
- Remove unused return value from end()
- Remove duplicated Javadoc
- Clean-up extra blank lines

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java

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=1816538&r1=1816537&r2=1816538&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/OutputFilter.java Tue Nov 28 
11:38:48 2017
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.io.IOException;
@@ -29,7 +28,6 @@ import org.apache.coyote.Response;
  */
 public interface OutputFilter extends OutputBuffer {
 
-
     /**
      * Some filters need additional parameters from the response. All the
      * necessary reading can occur in that method, as this method is called
@@ -58,12 +56,7 @@ public interface OutputFilter extends Ou
      * End the current request. It is acceptable to write extra bytes using
      * buffer.doWrite during the execution of this method.
      *
-     * @return Should return 0 unless the filter does some content length
-     * delimitation, in which case the number is the amount of extra bytes or
-     * missing bytes, which would indicate an error.
-     * Note: It is recommended that extra bytes be swallowed by the filter.
-     *
      * @throws IOException If an I/O error occurs while writing to the client
      */
-    public long end() throws IOException;
+    public void end() throws IOException;
 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java?rev=1816538&r1=1816537&r2=1816538&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 
Tue Nov 28 11:38:48 2017
@@ -139,32 +139,20 @@ public class ChunkedOutputFilter impleme
 
     // --------------------------------------------------- OutputFilter Methods
 
-    /**
-     * Some filters need additional parameters from the response. All the
-     * necessary reading can occur in that method, as this method is called
-     * after the response header processing is complete.
-     */
     @Override
     public void setResponse(Response response) {
         this.response = response;
     }
 
 
-    /**
-     * Set the next buffer in the filter pipeline.
-     */
     @Override
     public void setBuffer(OutputBuffer buffer) {
         this.buffer = buffer;
     }
 
 
-    /**
-     * End the current request. It is acceptable to write extra bytes using
-     * buffer.doWrite during the execution of this method.
-     */
     @Override
-    public long end() throws IOException {
+    public void end() throws IOException {
 
         Supplier<Map<String,String>> trailerFieldsSupplier = 
response.getTrailerFields();
         Map<String,String> trailerFields = null;
@@ -201,14 +189,9 @@ public class ChunkedOutputFilter impleme
             buffer.doWrite(crlfChunk);
             crlfChunk.position(0).limit(crlfChunk.capacity());
         }
-
-        return 0;
     }
 
 
-    /**
-     * Make the filter ready to process the next request.
-     */
     @Override
     public void recycle() {
         response = null;

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java?rev=1816538&r1=1816537&r2=1816538&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java 
Tue Nov 28 11:38:48 2017
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11.filters;
 
 import java.io.IOException;
@@ -35,13 +34,11 @@ import org.apache.juli.logging.LogFactor
  */
 public class GzipOutputFilter implements OutputFilter {
 
-
     protected static final Log log = LogFactory.getLog(GzipOutputFilter.class);
 
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * Next buffer in the pipeline.
      */
@@ -105,39 +102,27 @@ public class GzipOutputFilter implements
         }
     }
 
-    /**
-     * Some filters need additional parameters from the response. All the
-     * necessary reading can occur in that method, as this method is called
-     * after the response header processing is complete.
-     */
+
     @Override
     public void setResponse(Response response) {
         // NOOP: No need for parameters from response in this filter
     }
 
 
-    /**
-     * Set the next buffer in the filter pipeline.
-     */
     @Override
     public void setBuffer(OutputBuffer buffer) {
         this.buffer = buffer;
     }
 
 
-    /**
-     * End the current request. It is acceptable to write extra bytes using
-     * buffer.doWrite during the execution of this method.
-     */
     @Override
-    public long end()
-        throws IOException {
+    public void end() throws IOException {
         if (compressionStream == null) {
             compressionStream = new GZIPOutputStream(fakeOutputStream, true);
         }
         compressionStream.finish();
         compressionStream.close();
-        return ((OutputFilter) buffer).end();
+        ((OutputFilter) buffer).end();
     }
 
 

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java?rev=1816538&r1=1816537&r2=1816538&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 
Tue Nov 28 11:38:48 2017
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11.filters;
 
 import java.io.IOException;
@@ -31,10 +30,8 @@ import org.apache.coyote.http11.OutputFi
  */
 public class IdentityOutputFilter implements OutputFilter {
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * Content length.
      */
@@ -101,12 +98,6 @@ public class IdentityOutputFilter implem
 
     // --------------------------------------------------- OutputFilter Methods
 
-
-    /**
-     * Some filters need additional parameters from the response. All the
-     * necessary reading can occur in that method, as this method is called
-     * after the response header processing is complete.
-     */
     @Override
     public void setResponse(Response response) {
         contentLength = response.getContentLengthLong();
@@ -114,33 +105,18 @@ public class IdentityOutputFilter implem
     }
 
 
-    /**
-     * Set the next buffer in the filter pipeline.
-     */
     @Override
     public void setBuffer(OutputBuffer buffer) {
         this.buffer = buffer;
     }
 
 
-    /**
-     * End the current request. It is acceptable to write extra bytes using
-     * buffer.doWrite during the execution of this method.
-     */
     @Override
-    public long end()
-        throws IOException {
-
-        if (remaining > 0)
-            return remaining;
-        return 0;
-
+    public void end() throws IOException {
+        // NO-OP
     }
 
 
-    /**
-     * Make the filter ready to process the next request.
-     */
     @Override
     public void recycle() {
         contentLength = -1;

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java?rev=1816538&r1=1816537&r2=1816538&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java 
Tue Nov 28 11:38:48 2017
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11.filters;
 
 import java.io.IOException;
@@ -32,7 +31,6 @@ import org.apache.coyote.http11.OutputFi
  */
 public class VoidOutputFilter implements OutputFilter {
 
-
     // --------------------------------------------------- OutputBuffer Methods
 
     @Override
@@ -49,50 +47,26 @@ public class VoidOutputFilter implements
 
     // --------------------------------------------------- OutputFilter Methods
 
-
-    /**
-     * Some filters need additional parameters from the response. All the
-     * necessary reading can occur in that method, as this method is called
-     * after the response header processing is complete.
-     */
     @Override
     public void setResponse(Response response) {
         // NOOP: No need for parameters from response in this filter
     }
 
 
-    /**
-     * Set the next buffer in the filter pipeline.
-     */
     @Override
     public void setBuffer(OutputBuffer buffer) {
         // NO-OP
     }
 
 
-    /**
-     * Make the filter ready to process the next request.
-     */
     @Override
     public void recycle() {
         // NOOP: Nothing to recycle
     }
 
 
-    /**
-     * End the current request. It is acceptable to write extra bytes using
-     * buffer.doWrite during the execution of this method.
-     *
-     * @return Should return 0 unless the filter does some content length
-     * delimitation, in which case the number is the amount of extra bytes or
-     * missing bytes, which would indicate an error.
-     * Note: It is recommended that extra bytes be swallowed by the filter.
-     */
     @Override
-    public long end()
-        throws IOException {
-        return 0;
+    public void  end() throws IOException {
+        // NO-OP
     }
-
-
 }



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

Reply via email to