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-catalina/catalina/src/share/org/apache/coyote/tomcat5 Constants.java CoyoteInputStream.java CoyoteOutputStream.java CoyoteReader.java CoyoteRequest.java CoyoteResponse.java CoyoteWriter.java
Date Wed, 14 Apr 2004 00:14:22 GMT
remm        2004/04/13 17:14:22

  Modified:    catalina/src/share/org/apache/coyote/tomcat5 Constants.java
                        CoyoteInputStream.java CoyoteOutputStream.java
                        CoyoteReader.java CoyoteRequest.java
                        CoyoteResponse.java CoyoteWriter.java
  Log:
  - Treat the IS, OS, reader and writer as facades.
  - Those facades will be cleared, as with the request and response facades, if the
    security manager is enabled. So
  - I didn't test this too much, but the basic stuff seems to run fine.
  
  Revision  Changes    Path
  1.4       +1 -1      jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/Constants.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Constants.java	27 Feb 2004 14:58:52 -0000	1.3
  +++ Constants.java	14 Apr 2004 00:14:22 -0000	1.4
  @@ -48,7 +48,7 @@
       /**
        * Security flag.
        */
  -    protected static final boolean SECURITY = 
  +    public static final boolean SECURITY = 
           (System.getSecurityManager() != null);
   
   
  
  
  
  1.5       +11 -0     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteInputStream.java
  
  Index: CoyoteInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteInputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CoyoteInputStream.java	27 Feb 2004 14:58:52 -0000	1.4
  +++ CoyoteInputStream.java	14 Apr 2004 00:14:22 -0000	1.5
  @@ -49,6 +49,17 @@
       }
   
   
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * Clear facade.
  +     */
  +    void clear() {
  +        ib = null;
  +    }
  +
  +
       // --------------------------------------------- ServletInputStream Methods
   
   
  
  
  
  1.5       +11 -0     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteOutputStream.java
  
  Index: CoyoteOutputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteOutputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CoyoteOutputStream.java	6 Apr 2004 00:55:07 -0000	1.4
  +++ CoyoteOutputStream.java	14 Apr 2004 00:14:22 -0000	1.5
  @@ -45,6 +45,17 @@
       }
   
   
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * Clear facade.
  +     */
  +    void clear() {
  +        ob = null;
  +    }
  +
  +
       // --------------------------------------------------- OutputStream Methods
   
   
  
  
  
  1.6       +16 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteReader.java
  
  Index: CoyoteReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteReader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CoyoteReader.java	13 Apr 2004 15:18:42 -0000	1.5
  +++ CoyoteReader.java	14 Apr 2004 00:14:22 -0000	1.6
  @@ -43,7 +43,7 @@
       protected InputBuffer ib;
   
   
  -    protected final char[] lineBuffer = new char[MAX_LINE_LENGTH];
  +    protected char[] lineBuffer = null;
   
   
       // ----------------------------------------------------------- Constructors
  @@ -55,6 +55,17 @@
       }
   
   
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * Clear facade.
  +     */
  +    void clear() {
  +        ib = null;
  +    }
  +
  +
       // --------------------------------------------------------- Reader Methods
   
   
  @@ -113,6 +124,10 @@
   
       public String readLine()
           throws IOException {
  +
  +        if (lineBuffer == null) {
  +            lineBuffer = new char[MAX_LINE_LENGTH];
  +       }
   
           String result = null;
   
  
  
  
  1.34      +27 -5     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- CoyoteRequest.java	6 Apr 2004 00:55:07 -0000	1.33
  +++ CoyoteRequest.java	14 Apr 2004 00:14:22 -0000	1.34
  @@ -212,7 +212,7 @@
       /**
        * Reader.
        */
  -    protected BufferedReader reader = new CoyoteReader(inputBuffer);
  +    protected CoyoteReader reader = new CoyoteReader(inputBuffer);
   
   
       /**
  @@ -406,9 +406,19 @@
   
           mappingData.recycle();
   
  -        if ((Constants.SECURITY) && (facade != null)) {
  -            facade.clear();
  -            facade = null;
  +        if (Constants.SECURITY) {
  +            if (facade != null) {
  +                facade.clear();
  +                facade = null;
  +            }
  +            if (inputStream != null) {
  +                inputStream.clear();
  +                inputStream = null;
  +            }
  +            if (reader != null) {
  +                reader.clear();
  +                reader = null;
  +            }
           }
   
       }
  @@ -625,6 +635,9 @@
        * Return the input stream associated with this Request.
        */
       public InputStream getStream() {
  +        if (inputStream == null) {
  +            inputStream = new CoyoteInputStream(inputBuffer);
  +        }
           return inputStream;
       }
   
  @@ -717,6 +730,9 @@
        */
       public ServletInputStream createInputStream() 
           throws IOException {
  +        if (inputStream == null) {
  +            inputStream = new CoyoteInputStream(inputBuffer);
  +        }
           return inputStream;
       }
   
  @@ -987,6 +1003,9 @@
                   (sm.getString("coyoteRequest.getInputStream.ise"));
   
           usingInputStream = true;
  +        if (inputStream == null) {
  +            inputStream = new CoyoteInputStream(inputBuffer);
  +        }
           return inputStream;
   
       }
  @@ -1132,6 +1151,9 @@
   
           usingReader = true;
           inputBuffer.checkConverter();
  +        if (reader == null) {
  +            reader = new CoyoteReader(inputBuffer);
  +        }
           return reader;
   
       }
  
  
  
  1.13      +31 -6     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java
  
  Index: CoyoteResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CoyoteResponse.java	27 Feb 2004 14:58:53 -0000	1.12
  +++ CoyoteResponse.java	14 Apr 2004 00:14:22 -0000	1.13
  @@ -263,13 +263,23 @@
           
           cookies.clear();
   
  -        if ((Constants.SECURITY) && (facade != null)) {
  -            facade.clear();
  -            facade = null;
  +        if (Constants.SECURITY) {
  +            if (facade != null) {
  +                facade.clear();
  +                facade = null;
  +            }
  +            if (outputStream != null) {
  +                outputStream.clear();
  +                outputStream = null;
  +            }
  +            if (writer != null) {
  +                writer.clear();
  +                writer = null;
  +            }
  +        } else {
  +            writer.recycle();
           }
   
  -        writer.recycle();
  -
       }
   
   
  @@ -376,6 +386,9 @@
        * Return the output stream associated with this Response.
        */
       public OutputStream getStream() {
  +        if (outputStream == null) {
  +            outputStream = new CoyoteOutputStream(outputBuffer);
  +        }
           return outputStream;
       }
   
  @@ -433,6 +446,9 @@
       public ServletOutputStream createOutputStream() 
           throws IOException {
           // Probably useless
  +        if (outputStream == null) {
  +            outputStream = new CoyoteOutputStream(outputBuffer);
  +        }
           return outputStream;
       }
   
  @@ -488,6 +504,9 @@
       public PrintWriter getReporter() throws IOException {
           if (outputBuffer.isNew()) {
               outputBuffer.checkConverter();
  +            if (writer == null) {
  +                writer = new CoyoteWriter(outputBuffer);
  +            }
               return writer;
           } else {
               return null;
  @@ -540,6 +559,9 @@
                   (sm.getString("coyoteResponse.getOutputStream.ise"));
   
           usingOutputStream = true;
  +        if (outputStream == null) {
  +            outputStream = new CoyoteOutputStream(outputBuffer);
  +        }
           return outputStream;
   
       }
  @@ -569,6 +591,9 @@
   
           usingWriter = true;
           outputBuffer.checkConverter();
  +        if (writer == null) {
  +            writer = new CoyoteWriter(outputBuffer);
  +        }
           return writer;
   
       }
  
  
  
  1.5       +8 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteWriter.java
  
  Index: CoyoteWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CoyoteWriter.java	6 Apr 2004 00:55:07 -0000	1.4
  +++ CoyoteWriter.java	14 Apr 2004 00:14:22 -0000	1.5
  @@ -55,6 +55,14 @@
   
   
       /**
  +     * Clear facade.
  +     */
  +    void clear() {
  +        ob = null;
  +    }
  +
  +
  +    /**
        * Recycle.
        */
       void recycle() {
  
  
  

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


Mime
View raw message