From: Lane S. <la...@op...> - 2004-03-09 15:42:33
|
Hi Tim, Keats, I believe I understand the problem now fully. The melati infrastructure interleaves output. It expects a backing store for its writer independent of the response output stream. The interleave over time might look like this: t0: get outputstream t1: create writer; write a "templet" to the writer t2: write header to the response outputstream t3: write more to the writer t4: flush writer to the output stream In effect, the writer needs two objects: an internal buffer (type=OutputStream) and a final destination (the servlet response output stream) Unless I hear otherwise, I will update the Melati Writer I factored in and see if this presents a solution. -Lane Keats wrote: >You can still buffer. In fact, AFAIK the entire page is always buffered. >The FastWriter is still there in the background. What you lose is the >ability to manipulate the buffer. Normally you don't need this, which is >why we've hidden the FastWriter. If you need this capability you can still >do your own buffering. > >Anyway I think I understand your problem now. You need a Writer >implementation to make your code work, but if you use the Writer from the >response you get an InvalidStateException -- presumeably because somewhere >else you have already retrieved the OutputStream. You should be able to >finesse the problem by constructing a Writer on the OutputStream: > > Writer out = new OutputStreamWriter(request.getOutputStream(), >request.getEncoding()); > >You may even want to create a subclass of MetaliWriter, eg, >MetaliOutputStreamWriter, that does this for you in the constructor. > >Keats > >----- Original Message ----- >From: "Tim Pizey" <ti...@pa...> >To: <web...@li...> >Sent: Tuesday, March 02, 2004 7:07 AM >Subject: Re: [WebMacro-user] ANNOUNCE: WebMacro 2.0b1 has been released > > >On Tuesday 02 March 2004 10:30 am, Tim Pizey wrote: > > >>The Melati Template interface: >> >>public interface Template { >> void write(MelatiWriter out, TemplateContext templateContext, >> TemplateEngine engine) throws TemplateEngineException; >>} >> >>This works for Velocity, old WebMacro and JTemplater and probably others. >> >> > >As I (don't) understand it by removing the Writer layer you have removed the >ability to buffer, which is vital if you are to use sub-templates >(templets). > >TimP > > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Webmacro-user mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/webmacro-user > > > -- Lane Sharman For Protection from SPAM and Virus, Extend to the Network Your Perimeter of Defense: http://www.opendoors.com 858-755-2868 |