How do disable Transfer-Encoding in Tomcat 6

徘徊边缘 提交于 2019-11-28 07:00:17

The only way I could get it working is by setting the BufferSize on response.

response.setBufferSize() sets the Content-Length header of the response size. Once the response size goes beyond the bufferSize it would fallback to Transfer-Encoding: Chunked. The buffer size should be set to an appropriate value. Setting it to a higher value would buffer all of the response in memory before flushing it. So the value should be set to an optimistic size.

Few of my clients are depending on Content-Length response header. I have to set this for backward compatibility. By default Tomcat buffer size is set to 8K (I think for Weblogic/Websphere this is 32K bytes).

As far as I know, to disable chunked output in Tomcat you must supply a content length header in your servlet.

Adding a [Connection: close] header to the response prevents Tomcat from adding the [Transfer-Encoding: chunked] header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!