You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Hamilton <ha...@grunj.cat.org.au> on 2000/11/30 05:29:37 UTC
RE[2]: tomcat 3.2b8 and response.flushBuffer()
>Craig,
>
>I was wrong, it's not a problem with tomcat, it's
>a different behavior of the browsers: with navigator
>(and opera) flushBuffer works as expected, with ie the first
>time the page shows up only when completely loaded, but when
>reloading the page shows up before as it should, go guess..
>
Yeah Internet Exploder has a rather aggressive Caching
algorithm (if it can be called that??) and because it
refuses to use the MIME type specified in the Content-type
header, it can cache things that one doesn't really want
cache... I wrote a Data-level security module for Apache
and one of the things we had to add in the HTTP headers
just for IE is
Cache-control: no-cache
There is another one, that has escaped my head for the moment
but both needed to be there for the brain-dead to truly not
cache something that just shouldn't be cached.....
Scott, Esq.
Re: tomcat 3.2b8 and response.flushBuffer()
Posted by Mauro Bertapelle <ma...@jmatica.com>.
Scott,
I've finally got it.
The problem with Internet Explorer is that, no matter
how many flavors of no-cache, cache-no, no-cache-thanks, etc..
you put in your header, it'll not output anything until it
has read at least 256 characters:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
response.setIntHeader("Expires", -1);
response.addHeader("Cache-Control", "no-cache");
response.addHeader("pragma", "no-cache");
PrintWriter out = response.getWriter();
out.println("<html>"); // 7
out.println("<head><title>Title</title>"); // 34
out.println("</head><body>"); // 48
out.println("<!-----------------------------------------------------------------------------"); // 128
out.println("-------------------------------------------------------------------------------"); // 208
// out.println("---------------------------------> phase 1<br>"); // 255, doesn't display till end of page
out.println("----------------------------------> phase 1<br>"); // 256, start display immediately
response.flushBuffer();
try {
Thread.sleep(5000);
} catch (Exception e) {
};
out.println("phase 2");
out.println("</body>");
out.println("</html>");
out.close();
}
Regards,
Mauro Bertapelle
JMatica Srl
mauro.bertapelle@jmatica.com
--