Now, I don't know what your problem is. Look into Turbine.java line 388
(latest CVS).
As you can see, whatever value page was set (that is whatever output was
generated by Turbine
MVC model) is ignored, and simply not sent to the browser - if
data.isOutSet() is true, which
happens when you call data.getOut(). Once you have taken PrintWriter by
getOut() outSet variable
remains true, and Turbine simply finishes processing, assuming that
everything you wanted to send
to the browser was already sent. That's all. Look for yourself in
RunData.java and Turbine.java.
BTW. Reply to LIST, not for my private e-mail.
Steve Ruby wrote:
>
> And I can do that from within doBuildTemplate or do I need to write
> that into some other method? I had doBuildTemplate almost
> exactly as you say (I added the data.getOut();)
>
> Here is a simplified version.
>
> public void doBuildTemplate( RunData data, WebContext context ) throws
> Exception
> {
>
> //deleted some code here that loads the file into byte[] called
> buffer
>
> data.getResponse().setContentType("image/jpeg");
> data.getOut();
> data.getResponse().setDateHeader("Last-Modified",
> file.lastModified());
> data.getResponse().setHeader("Accept-Ranges","bytes");
> data.getResponse().setContentLength(buffer.length);
> data.getResponse().getOutputStream().write ( buffer );
> data.getResponse().getOutputStream().close();
>
> }
>
> Problem is it returns the default layout from turbine. Not the file.
>
> Thanks..
>
> Tomasz Skutnik wrote:
> >
> > You can simply set response content-type by yourself, and output
> > all binary data using OutputStream object attached to
> > HttpServletResponse.
> > However you have to retrieve PrintWriter object from RunData first, to
> > prevent displaying
> > all template-generated stuff by Turbine:
> >
> > // Whatever content-type you need
> > data.getResponse().setContentType("image/jpeg");
> > // Bogus, used only to fool Turbine.
> > data.getOut();
> > // Here's real output stream to write to
> > ServletOutputStream out = data.getResponse().getOutputStream();
> >
> > >From now on you can use "out" object to send arbitrary binary data to
> > client (browser :). Don't forget to close it :)
> >
> > Scooter.
> >
> > Steve Ruby wrote:
> > >
> > > I have an application that is made up of screens that
> > > extend ClientFilesSiteScreen (ClientFilesSiteScreen) extends
> > > WebMacroSiteSecureScreen.
> > >
> > > On a given screen I made need alternatively write binary data
> > > out to the user.. Is there a way (proper way) to opt out
> > > of processing the template in doBuildTemplate(data,context)
> > > and write binary directly to the client, changing the
> > > ContentType and and everything. Obviously I need to have
> > > it skip looking for a template, or processing the layout
> > > at all.
> > >
> > > I've got an exisitng servlet (not turbine) that reads
> > > the appropriate data and writes it out, it does everything
> > > I need but it doesn't fit into the turbine security model.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]