In Engine.handler, Cocoon tries to get an OutputStream to write the outBuf data, but the dummy implementation provided by EngineWrapper returns null..! Did that ever worked? =) Anyway, here's the patch: Index: Cocoon.java =================================================================== RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v retrieving revision 1.21 diff -u -r1.21 Cocoon.java --- Cocoon.java 2001/01/18 22:43:45 1.21 +++ Cocoon.java 2001/02/22 04:24:16 @@ -269,7 +269,7 @@ String userAgent = null; String xml = null; String out = null; - PrintWriter writer = null; + OutputStream os = null; Configurations confs = null; if (argument.length == 0) @@ -305,10 +305,10 @@ EngineWrapper engine = new EngineWrapper(confs); if (out == null) - writer = new PrintWriter(System.out); + os = System.out; else - writer = new PrintWriter(new FileWriter(out), true); - engine.handle(writer, new File(xml)); + os = new FileOutputStream(out); + engine.handle(os, new File(xml)); } private static void usage() { Index: EngineWrapper.java =================================================================== RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/EngineWrapper.java,v retrieving revision 1.13 diff -u -r1.13 EngineWrapper.java --- EngineWrapper.java 2001/01/11 13:52:19 1.13 +++ EngineWrapper.java 2001/02/22 04:24:17 @@ -83,11 +83,11 @@ this.userAgent = (String)confs.get("user-agent"); } - public void handle(PrintWriter out, File pathToDocument) throws Exception { + public void handle(OutputStream out, File pathToDocument) throws Exception { this.engine.handle(new HttpServletRequestImpl(pathToDocument), new HttpServletResponseImpl(out)); } - public void handle(PrintWriter out, File documentPath, String document) throws Exception { + public void handle(OutputStream out, File documentPath, String document) throws Exception { this.engine.handle(new HttpServletRequestImpl(documentPath, document), new HttpServletResponseImpl(out)); } @@ -188,19 +188,33 @@ */ public class HttpServletResponseImpl implements HttpServletResponse { - private PrintWriter out; + private OutputStream out; - public HttpServletResponseImpl(PrintWriter out) { + public HttpServletResponseImpl(OutputStream out) { this.out = out; } public PrintWriter getWriter() throws IOException { - return this.out; + return new PrintWriter(new OutputStreamWriter(this.out)); } + + public ServletOutputStream getOutputStream() throws IOException { + return new ServletOutputStream() + { + public void write(int c) throws IOException + { + out.write(c); + } + public void write(byte[] b, int off, int len) + throws IOException + { + out.write(b,off,len); + } + }; + } public void setContentLength(int len) {} public void setContentType(String type) {} - public ServletOutputStream getOutputStream() throws IOException { return null; } public String getCharacterEncoding() { return null; } public void addCookie(Cookie cookie) {} public boolean containsHeader(String name) { return false; }