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

Reply via email to