Push down inputStream as it is only used by BIO
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 12 Aug 2011 15:17:50 +0000 (15:17 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 12 Aug 2011 15:17:50 +0000 (15:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1157151 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/AbstractInputBuffer.java
java/org/apache/coyote/http11/InternalInputBuffer.java

index 7788b87..a81d642 100644 (file)
@@ -17,7 +17,6 @@
 package org.apache.coyote.http11;
 
 import java.io.IOException;
-import java.io.InputStream;
 
 import org.apache.coyote.InputBuffer;
 import org.apache.coyote.Request;
@@ -137,12 +136,6 @@ public abstract class AbstractInputBuffer implements InputBuffer{
 
 
     /**
-     * Underlying input stream.
-     */
-    protected InputStream inputStream;
-
-
-    /**
      * Underlying input buffer.
      */
     protected InputBuffer inputStreamInputBuffer;
@@ -171,28 +164,6 @@ public abstract class AbstractInputBuffer implements InputBuffer{
 
 
     /**
-     * Set the underlying socket input stream.
-     */
-    public void setInputStream(InputStream inputStream) {
-
-        // FIXME: Check for null ?
-
-        this.inputStream = inputStream;
-
-    }
-
-
-    /**
-     * Get the underlying socket input stream.
-     */
-    public InputStream getInputStream() {
-
-        return inputStream;
-
-    }
-
-
-    /**
      * Add an input filter to the filter library.
      */
     public void addFilter(InputFilter filter) {
@@ -271,7 +242,6 @@ public abstract class AbstractInputBuffer implements InputBuffer{
         // Recycle Request object
         request.recycle();
 
-        inputStream = null;
         lastValid = 0;
         pos = 0;
         lastActiveFilter = -1;
index 081fa75..6c06d74 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.coyote.http11;
 
 import java.io.EOFException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.nio.charset.Charset;
 
 import org.apache.coyote.InputBuffer;
@@ -39,6 +40,12 @@ public class InternalInputBuffer extends AbstractInputBuffer {
 
 
     /**
+     * Underlying input stream.
+     */
+    protected InputStream inputStream;
+
+
+    /**
      * Default constructor.
      */
     public InternalInputBuffer(Request request, int headerBufferSize) {
@@ -59,6 +66,29 @@ public class InternalInputBuffer extends AbstractInputBuffer {
 
     }
 
+    
+    /**
+     * Set the underlying socket input stream.
+     */
+    public void setInputStream(InputStream inputStream) {
+
+        // FIXME: Check for null ?
+
+        this.inputStream = inputStream;
+
+    }
+
+
+    /**
+     * Get the underlying socket input stream.
+     */
+    public InputStream getInputStream() {
+
+        return inputStream;
+
+    }
+
+
     /**
      * Read the request line. This function is meant to be used during the 
      * HTTP request header parsing. Do NOT attempt to read the request body 
@@ -428,6 +458,13 @@ public class InternalInputBuffer extends AbstractInputBuffer {
     }
 
 
+    @Override
+    public void recycle() {
+        super.recycle();
+        inputStream = null;
+    }
+
+
     // ------------------------------------------------------ Protected Methods