12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Large data transfer<br />

Downloading large data<br />

The following modes are available for downloading large data from the <strong>Borland</strong> <strong>web</strong><br />

container to the browser:<br />

■<br />

■<br />

Chunked download<br />

Non-chunked download<br />

Implementing chunked download<br />

In the chunked download mode, the <strong>Borland</strong> <strong>web</strong> container does not wait until it has all<br />

the data to send. As soon as servlet generates the data, the <strong>web</strong> container starts<br />

sending the data to the browser via Apache in fixed size buffers.<br />

Because the data is flushed as soon as it is available, the chunked download mode of<br />

transfer has low memory requirements both on Apache and the <strong>Borland</strong> <strong>web</strong> container.<br />

The browser user sees data as it arrives rather than as one large lump at the end of the<br />

full transfer.<br />

Enabling chunked download<br />

To enable chunked download mode, you update the <strong>Borland</strong> <strong>web</strong> container <strong>server</strong>.xml<br />

file which is stored in your Partition's data directory:<br />

adm/tomcat/conf/<br />

For more information, go to Chapter 4, “Web components.”<br />

To enable the chunked download:<br />

1 In the <strong>Borland</strong> <strong>web</strong> container <strong>server</strong>.xml, locate the section of<br />

the code.<br />

2 For the IIOP service you want to enable chunked download, set<br />

enableChunking="true"<br />

3 By default, the download buffer size is set to 4096. To change it for an IIOP service,<br />

use the downloadBufferSize attribute as follows:<br />

downloadBufferSize=<br />

Where is a numeric value >0.<br />

Note If an invalid value is presented (non numeric/negative number) then the default 4096<br />

value is employed.<br />

The chunked download mode of transfer has an overhead of an extra thread per each<br />

request.<br />

Known content length versus unknown<br />

Based on whether content length is known in advance or not, chunked download mode<br />

can take one of the following two paths:<br />

■<br />

■<br />

chunked download with known content length<br />

chunked download with unknown content length<br />

Chunked download with known content length<br />

In this case, a servlet or JSP knows the content length of the data in advance of the<br />

transfer. The servlet sets the Content-Length HTTP header before writing out the data.<br />

The <strong>Borland</strong> <strong>web</strong> container writes out a single response header followed by multiple<br />

chunks of data. Apache receives this from the <strong>web</strong> container and sends data in the<br />

same fashion to the browser.<br />

The response header contains the following header:<br />

Content-Length=<br />

48 BES Developer’s Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!