Tomcat does not flush the response buffer

后端 未结 4 1690
[愿得一人]
[愿得一人] 2020-12-11 05:10

i tested HttpResponse#flushBuffer and PrintWriter#flush on Tomcat 7 below, but it seemed that the response rather ignored them than fl

4条回答
  •  爱一瞬间的悲伤
    2020-12-11 05:29

    The API for flushBuffer() is very precise:

    Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.

    So either Tomcat is not implemented according to the spec (buffers more aggressively and holds flushes if they are too small) or the client (browser) waits for more input before actually rendering it.

    Can you try with curl or nc instead?

提交回复
热议问题