The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient.
Content-Length:
The length in decimal number of octets.
Transfer-Encoding
The Transfer-Encoding header specifies the form of encoding used to safely transfer the payload body to the user.
HTTP/2 doesn’t support HTTP 1.1’s chunked transfer encoding mechanism, as it provides its own, more efficient, mechanisms for data streaming.
Chunked encoding is useful when larger amounts of data are sent to the client and the total size of the response may not be known until the request has been fully processed. For example, when generating a large HTML table resulting from a database query or when transmitting large images.
// org.apache.catalina.connector.OutputBuffer#doFlush /** * Flush bytes or chars contained in the buffer. * * @param realFlush <code>true</code> if this should also cause a real network flush * @throws IOException An underlying IOException occurred */ protectedvoiddoFlush(boolean realFlush)throws IOException {
if (realFlush) { coyoteResponse.action(ActionCode.CLIENT_FLUSH, null); // If some exception occurred earlier, or if some IOE occurred // here, notify the servlet with an IOE if (coyoteResponse.isExceptionPresent()) { thrownew ClientAbortException(coyoteResponse.getErrorException()); } }