Show TOC Start of Content Area

Function documentation Response Chunking  Locate the document in its SAP Library structure

Use

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.

Integration

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.

Features

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-Lengthheader. 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-Lengthheader of the response message whenever possible. This behavior achieves best overall performance of the web application. When the servlet does not set the Content-Lengthheader 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).

Activities

You can switch this function on by setting the EnableChunkedResponse property of Web Container Service to true. Use the NetWeaver Administrator to do it:

       1.       To modify the properties of the Web Container Service using the NetWeaver Administrator, use the Java System Properties function. For more information, see Java System Properties.

       2.      In the Services tab, select Web Container Service.

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

       3.      Edit the EnableChunkedResponse property.

       4.      Choose Save Changes.

 

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

 

End of Content Area