Hi,

Apologies if this has been asked before but the search on the mailing list archive 
directs to port 9999 at the moment which I cannot access from behind my firewall.

I'm trying to get the small servlet 'push' example below working but tomcat
appears to ignore the requests to flush it's buffers.

The content does not leave the server until the page is finished.

I'm guessing that people must be already doing this sort of thing, so what have
I missed?

Tomcat: 3.2.1
JDK: 1.2.2
OS: Linux 2.2.18

thanks,

- Dale

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class TestPushServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp) {
        try {
            resp.setBufferSize(0);
            resp.setContentType("text/html");

            PrintWriter out = resp.getWriter();

            out.println("<html><head><title>TestPushServlet</title></head><body>");

            for (int i = 0; i < 10; i++) {
                Thread.sleep(2000);
                out.println(i + "<br>");
                out.flush();
                resp.flushBuffer();
            }
            out.println("</body></html>");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to