Commits

mbogaert  committed 280abd7

WW-720: Add content-length to StreamResult.

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@677573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits d63169b

Comments (0)

Files changed (1)

File src/java/com/opensymphony/webwork/dispatcher/StreamResult.java

  */
 public class StreamResult extends WebWorkResultSupport {
     protected String contentType = "text/plain";
+    protected int contentLength;
     protected String contentDisposition = "inline";
     protected String inputName = "inputStream";
     protected int bufferSize = 1024;
     }
 
     /**
+     * @return Returns the contentLength.
+     */
+    public int getContentLength() {
+        return contentLength;
+    }
+
+    /**
+     * @param contentLength The contentLength to set.
+     */
+    public void setContentLength(int contentLength) {
+        this.contentLength = contentLength;
+    }
+
+    /**
      * @return Returns the Content-disposition header value.
      */
     public String getContentDisposition() {
         // Set the content type
         oResponse.setContentType(conditionalParse(contentType, invocation));
 
+        // Set the content length
+        if (contentLength > 0) {
+             oResponse.setContentLength(contentLength);
+        }
+
         // Set the content-disposition
         if (contentDisposition != null) {
             oResponse.addHeader("Content-disposition", conditionalParse(contentDisposition, invocation));