Show TOC

Response ChunkingLocate this document in the navigation structure


If this function is switched on, the Web Container Service applies chunked transfer encoding (defined by HTTP 1.1 specification) to dynamically generated responses that are sent back to the client. It is an important feature when transferring responses with large message bodies.


Response chunking is used in client-server communication over persistent connections. As defined by HTTP 1.1 specification, persistent connections are used by default. This implies that the server needs a mechanism to inform the client for the end of the response message, generated dynamically by a servlet or a JSP. There are three possible options to do this:

  • When the client receives the whole amount of data as specified in Content-Length header of the response message.

  • When the container applies the HTTP 1.1 chunked transfer encoding to the response message. It has its own mechanism to inform client when the last chunk of data has been sent to it.

  • When the server closes the socket.

To improve performance, the HTTP server always tries to preserve persistent connection. The mechanism for identifying the end of a response message follows the order above.


Response chunking is a function of the Web Container Service itself. When it is switched on, the system applies chunked encoding only if the response message does not contain Content-Length header. In other words, servlets do not take care of maintaining persistent connections when they cannot determine the exact length of the response message body since the container does it by chunking the response or adding a Content-Length header when possible.

The preferred servlet behavior when sending the generated response to the client, is to set the Content-Length header of the response message whenever possible. This behavior achieves best overall performance of the web application. When the servlet does not set the Content-Length header of the message two alternatives are possible:

  • If the size of the generated response message does not exceed the response buffer size, then the container automatically sets the Content-Length header.

  • If the response message is bigger than the buffer or the buffer has been flushed, a persistent connection is maintained using the HTTP 1.1 chunked encoding. The Web Container Service appends the corresponding chunk header to each part of the response message that is being flushed out of the response buffer. Then each part is sent to the client. The connection is not closed and the client keeps waiting for the remaining parts of the response message to be sent to it (according to chunked encoding).


You can activate this function by setting the EnableChunkedResponse property of Web Container Service to true in SAP NetWeaver Administrator:

  1. In SAP NetWeaver Administrator, use Java System Properties to modify the properties of the Web Container Service. For more information, see Java System Properties .

  2. In Start of the navigation path Java System Properties Next navigation step Services End of the navigation path, select Web Container Service.

    On the Extended Details tab page, a list of all service properties is displayed.

  3. Select the EnableChunkedResponse property and modify its value to true.

  4. Choose Save .

To disable response chunking, set the EnableChunkedResponse property to false .