This is possibly created because the response is bigger than the response buffer, so the runtime is forced to flush before the response is complete. Since headers must be sent before the response and the Content-Length
header is unknown, it sets Transfer-Encoding: chunked
instead.
You could set the output buffer size for the Tomcat connector: see here, attribute socketBuffer
for the standard and socket.appWriteBufSize
for NIO. This sets the buffer size for the entire servlet containe, probably not what you want.
You could intercept the specific URL(s) that require a bigger buffer with a servlet filter and use response.setBufferSize(NNN)
.