I'm attempting to use HTTP Streaming with a servlet. Locally I use orion as a servlet container and it works fine, but on the test server, which runs JRUN 4.0, the output is buffered even when I call flush() on the output stream. Any thoughts on why the output is being buffered and what I can do to stop it?
OutputStream os = servletResponse.getOutputStream();
while (true)
{
//attempt to write to output before doing anything else. If browser has disconnected, an IOException will be thrown so nothing else will be done
os.write(".".getBytes());
os.flush();
String response = getData();
os.write(response.getBytes());
os.flush();
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
}
}