[Action2] StreamResult Patch

2006-04-09 Thread Eric Molitor
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..


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]

Re: [Action2] StreamResult Patch

2006-04-10 Thread James Mitchell
Any chance you could attach this to a jira ticket?  That's the normal  
process, so that your contribution won't be forgotten.  If you can't,  
I'll try add it to jira tomorrow.


Thanks for your help.

--
James Mitchell




On Apr 10, 2006, at 2:37 AM, Eric Molitor wrote:


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..


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

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



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



Re: [Action2] StreamResult Patch

2006-04-11 Thread Eric Molitor
WW-1281 created

Once I get a chance to look at why the unit tests aren't running tI'll
add a bit more.

I've also been looking at an alternate approach that would allow any
Result (anything that extends StrutsResultSupport) to recieve its
parameters from the stack.

Cheers,
   Eric

On 4/10/06, James Mitchell <[EMAIL PROTECTED]> wrote:
> Any chance you could attach this to a jira ticket?  That's the normal
> process, so that your contribution won't be forgotten.  If you can't,
> I'll try add it to jira tomorrow.
>
> Thanks for your help.
>
> --
> James Mitchell
>
>
>
>
> On Apr 10, 2006, at 2:37 AM, Eric Molitor wrote:
>
> > 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..
> > 
> >
> > 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
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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