This patch allows the parameters for the stream result to be read from
the stack. I seem to be having issues running the unit tests so none
are included. (I'll probably work on some later). Precedence is given
to values on the stack over values in the XML file.

I plan to use the patch as follows

In xwork.xml I create a global stream result..
<result name="stream" type="stream" />

Then in my actions I create getter methods for the various parameters
(probably just contentDisposition, contentType, and contentLength) and
then just return "stream" as the result of my execute method.

Cheers,
   Eric
Index: action/src/main/java/org/apache/struts/action2/dispatcher/StreamResult.java
===================================================================
--- action/src/main/java/org/apache/struts/action2/dispatcher/StreamResult.java	(revision 392878)
+++ action/src/main/java/org/apache/struts/action2/dispatcher/StreamResult.java	(working copy)
@@ -157,7 +157,27 @@
     }
 
     protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
+        if(invocation.getStack().findString("contentDisposition") != null) {
+            setContentDisposition(invocation.getStack().findString("contentDisposition"));
+        }
 
+        if(invocation.getStack().findString("contentType") != null) {
+            setContentType(invocation.getStack().findString("contentType"));
+        }
+
+        if(invocation.getStack().findString("inputName") != null) {
+            setInputName(invocation.getStack().findString("inputName"));
+        }
+
+        if(invocation.getStack().findValue("contentLength", Integer.class) != null ) {
+            setContentLength(((Integer) invocation.getStack().findValue("contentLength", Integer.class)).intValue());
+        }
+
+        if(invocation.getStack().findValue("bufferSize", Integer.class) != null) {
+            setBufferSize(((Integer) invocation.getStack().findValue("bufferSize", Integer.class)).intValue());
+        }
+
+
         InputStream oInput = null;
         OutputStream oOutput = null;
 









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to