user manual
Chapter 5: Web server to web container connectivity 51
Large data transfer
■
chunked download with known content length
■
chunked download with unknown content length
Chunked download with known content length
In this case, a servlet or JSP knows the content length of the data in advance
of the transfer. The servlet sets the Content-Length HTTP header before writing
out the data. The Borland web container writes out a single response header
followed by multiple chunks of data. Apache receives this from the web
container and sends data in the same fashion to the browser.
The response header contains the following header:
Content-Length=<actual data size>
Chunked download with unknown content length
HTTP protocol version 1.1 adds a new feature to handle the case of data
transfer when data length is not known in advance. This feature is called
HTTP chunking. In this case, a servlet does not know the content length of the
data in advance of a transfer. The servlet does not set the Content-Length
HTTP header.
The Borland web container sends the data to the Apache web server in
exactly the same way as in the case of the chunked download where the
content length is known in advance; a single response header is sent followed
by multiple data chunks. The response header contains the following header:
Transfer-Encoding="chunked"
If the browser protocol is HTTP 1.1 and the Content-Length header is not set by
the servlet, the Borland web container automatically adds the Transfer-
Encoding="chunked" header.
When an Apache web server sees this Transfer-Encoding header, it starts
sending the data as "HTTP chunks" - a response header followed by multiple
combinations of "chunked" header, "chunked" data, and "chunked" trailers.
Note Per the HTTP 1.1 specification, if a servlet sets both the Content-Length and
Transfer-Encoding headers, the Content-Length header is dropped by the
Borland web container.
Browsers supporting only the HTTP 1.0 protocol
If the browser only supports the HTTP 1.0 protocol or less and a servlet does
not set the Content-Length header, the Borland web container can not
automatically add the Transfer-Encoding header. The reason being that to the
HTTP 1.0 protocol, the Transfer-Encoding header has no meaning. In this case,
the Borland web container:
1 buffers all the data until the data is finished,
2 calculates the content length, and
3 sets the Content-Length header itself.










