sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1062713 - in /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl: output/BufferProvider.java request/ContentData.java request/RequestData.java
Date Mon, 24 Jan 2011 10:07:03 GMT
Author: fmeschbe
Date: Mon Jan 24 10:07:02 2011
New Revision: 1062713

URL: http://svn.apache.org/viewvc?rev=1062713&view=rev
Log:
SLING-1951 Provide sensible default (the buffer size used by the servlet container for the
current response) for the internal buffer size

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/output/BufferProvider.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/ContentData.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/output/BufferProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/output/BufferProvider.java?rev=1062713&r1=1062712&r2=1062713&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/output/BufferProvider.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/output/BufferProvider.java
Mon Jan 24 10:07:02 2011
@@ -24,14 +24,40 @@ import java.io.PrintWriter;
 import javax.servlet.ServletOutputStream;
 
 /**
- * The <code>BufferProvider</code> provides
- * buffered versions of the servlet output
- * stream and the print writer.
+ * The <code>BufferProvider</code> provides buffered versions of the servlet
+ * output stream and the print writer.
  */
 public interface BufferProvider {
 
+    /**
+     * Sets the size of the buffer to be used (by default) for output streams
+     * returned by {@link #getOutputStream()} or writers returned by
+     * {@link #getWriter()}
+     *
+     * @param size The default buffersize. Negative values or zero disable
+     *            buffering.
+     */
+    void setBufferSize(int size);
+
+    /**
+     * @return the currently set buffer size. This is either some default buffer
+     *         size or the size last set by the {@link #setBufferSize(int)}
+     *         method.
+     */
+    int getBufferSize();
+
+    /**
+     * @return a buffered <code>ServletOutputStream</code> whose initial buffer
+     *         size is set to {@link #getBufferSize()}.
+     * @throws IOException If an error occurrs setting up the output stream
+     */
     ServletOutputStream getOutputStream() throws IOException;
 
+    /**
+     * @return a buffered <code>PrintWriter</code> whose initial buffer size
is
+     *         set to {@link #getBufferSize()}.
+     * @throws IOException If an error occurrs setting up the writer
+     */
     PrintWriter getWriter() throws IOException;
 
 }

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/ContentData.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/ContentData.java?rev=1062713&r1=1062712&r2=1062713&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/ContentData.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/ContentData.java
Mon Jan 24 10:07:02 2011
@@ -57,6 +57,7 @@ public class ContentData implements Buff
         this.resource = resource;
         this.requestPathInfo = requestPathInfo;
         this.parent = parent;
+        this.requestedBufferSize = parent.getBufferSize();
     }
 
     /* package */void dispose() {

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java?rev=1062713&r1=1062712&r2=1062713&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
Mon Jan 24 10:07:02 2011
@@ -638,6 +638,14 @@ public class RequestData implements Buff
                 : this;
     }
 
+    public int getBufferSize() {
+        return getServletResponse().getBufferSize();
+    }
+
+    public void setBufferSize(int size) {
+        getServletResponse().setBufferSize(size);
+    }
+
     public ServletOutputStream getOutputStream() throws IOException {
         return getServletResponse().getOutputStream();
     }



Mime
View raw message