On Thu, 9 May 2002, Remy Maucherat wrote: > > Does servlet specification require you to call flush() to ensure that > > the client actually see the bytes? > > A. No, spec does not mandate this behavior for webapps. > > B. "you have to flush your writer. Otherwise, because of timing > > problems, the bytes will not get written" (bug 8916) > > If you instantiate a buffered writer yourself (instead of using > resp.getWriter) > to wrap around resp.getOutputStream, you have to flush it. > So it's B.
That's a java limitation BTW, if you wrap the writer returned by getWriter there's no way to get the info from the wraper's buffer ( if you use a BufferedWriter or something ). But if you just use the original writer it should work without a flush. ( and I think it does work ) > > Question 2 > > Where in servlet spec (or RFC 2616, your choice) does it allow > > the container to replace the message body or content-type header for > an > > application that has set the status code to 2xx? > > A. It doesn't. It shouldn't. That would be clearly wrong. > > B. 200's and 204's are left alone, all other 2xx status codes are > > fair game to have their headers and body replaced. > > If the servlet didn't do anything other that set headers, and did not write > any > content, it doesn't contrdict any spec, and is desirable if the client is a > web browser. > B also. I'm not sure I agree - if the user want to send an empty page ( with a 2xx response ) that's perfectly fine. For 4xx he is required to define error-pages in web.xml if he wants, and the server may use whatever defaults ( since the user can tune the behavior in web.xml ), but for 2xx it's a bad idea to mess with the content. Some headers ( like Content-Length, Content-Type ) can/should be altered ( to insert the charset or set a default content type ) ( I'm not sure we are allowed to set a default content type if a servlet didn't suplied one - again if the user doesn't want one he should be able to get that ) Costin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>