Henning,

On Wed, 2003-03-19 at 13:12, Henning P. Schmiedehausen wrote:
> Peter Courcoux <[EMAIL PROTECTED]> writes:
> 
> >Hi all,
> 
> >I have recently changed from using turbine 2.2-b3 to 2.2.1 and from
> >using VelocityECSLayout to VelocityOnlyLayout.
> 
> Actually, I'm getting more and more unhappy with the deprecation of
> VelocityECSLayout. There seem to be many quirks that can't be fixed
> in a clean manner. We might have to think about this a little more.
> 
> >One of my actions which extends VelocitySecureAction handles a file
> >download by obtaining the HttpServletResponse setting the headers and
> >then obtaining and writing directly to the ServletOutputStream. 
> 
> >Before the changes outlined above this caused no problem. Having made
> >the changes the following Exception occurs after the completion of the
> >download and closing the ServletOutputStream. 
> 
> Could you please post some code snippets. How do you do the file
> download? Directly from the action (you shouldn't do that) or do you
> have a screen which does the download to which you redirect? I'm
> getting a little scared by reading that you try to manipulate the
> Servlet output stream by yourself. :-)
> 
>       Regards
>               Henning

As mentioned off-list, I have a need to build a zip file of multiple
download files and the easiest way I have found is to directly
manipulate the ServletOutputStream. This also applies where I am
building images for embedding within pages of data. 

I have solved this by creating a DirectResponseLayout class which does
nothing except check that declareDirectResponse() has been called on 
RunData. I then call 

data.setLayout("DirectResponseLayout"); 

in my Action class.

The full (very simple) class listing is in a message I just posted on
turbine-user.

One drawback is that it calls data.isOutSet() which is deprecated.

Questions.

1. Is there a better way?
2. If not, would it be worth including the DirectResponseLayout class in
        the turbine distribution. 
3. Is there a case for removing the deprecation of RunData.isOutSet()? 
4. Is this worth documenting. At least one other user appears to be 
        doing something similar.

Regards

Peter
-- 
Peter Courcoux <[EMAIL PROTECTED]>

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

Reply via email to