Sorry the conditional in my code was back to front. Should be
if(data.getResponseBody() == null) > -----Original Message----- > From: Gareth Coltman [mailto:[EMAIL PROTECTED]] > Sent: 01 February 2002 10:09 > To: Turbine Developers List > Subject: Possible patch to allow files to be streamed back from action > > > The best patch I can think of is as follows: > > 1. Change RunData to include a responseBody object. This would > probably be a > byte array so it could handle both text and binary data. > > 2. Add a call in the execute method of the DefaultTargetValue to check if > the responseBody has already been set. If not the normal rendering process > should take place. If it does contain data, it should be buffered back to > the output stream, and any other targets ignored. > > ie: > > protected void execute(RunData data) > throws Exception > { > data.getResponse().setLocale(data.getLocale()); > data.getResponse().setContentType(data.getContentType()); > > if(data.getResponseBody() != null) > { > > runner.run(targetModuleType, data); > > String target = data.getTarget(); > > Renderer r = new DirectRenderer(data.getOut()); > TemplateContext context = Module.getTemplateContext(data); > context.put("renderer", r); > context.put("template", target); > context.put("runner", runner); > > // now we can use the renderer here > // use the renderer to start the whole shabang > String layoutTemplate = Turbine.getResolver() > .getTemplate("layouts", target); > String out = r.render(data, layoutTemplate); > if (out != null && out.length() > 0) > { > // Write the response directly to the output stream. > data.getOut().print(out); > } > } > else > // BUFFER THE getReponseBody byte[] ONTO THE OUTPUT STREAM > } > } > > ??? > > Any ideas? > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
