You can find at:

http://jakarta.apache.org/~raphael/valocity/

a patch for Velocity that forces the engine to flush
its generated content before any reference evaluation.

This enables Velocity to be used in a JSP-like streamed mode and
especially embed JSP/servlet output within a Velocity template.

This feature is necessary so that the Jetspeed portal can use Velocity
templates by default but still aggregate servlet/JSP generated content.

--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris
Index: ASTReference.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
retrieving revision 1.36
diff -u -r1.36 ASTReference.java
--- ASTReference.java   2001/08/11 18:58:07     1.36
+++ ASTReference.java   2001/08/16 14:46:25
@@ -237,6 +237,20 @@
     public boolean render( InternalContextAdapter context, Writer writer)
         throws IOException, MethodInvocationException
     {
+        /*
+         * Make sure to flush the writer before trying to execute the
+         * reference, to allow for methods that stream directly to the 
+         * underlying OutputStream or Writer
+         */
+        try
+        {
+            writer.flush();
+        }
+        catch (IOException e)
+        {
+            //ignore this, it will crop up later
+        }
+        
         Object value = execute(null, context);
         
         /*

Reply via email to