System Template
sendHTTPheaders()
Force all HTTP headers to be sent to the browser now.
Syntax
void = rb.page.sendHTTPheaders()
Parameters
The 'sendHTTPheaders' method takes no parameters
Results
The 'sendHTTPheaders' method returns no useful information.
Remarks The normal behaviour of the Presentation Engine is to process a page request completely and the
send the generated output to the browser. This means the browser will not send any output to the
client until the entire page has completed. In general this behaviour is fine. However most browsers
will eventually timeout a request if they do not receive at least the headers within a certain,
browser specific, time. As long as the headers are sent the browser will wait patiently for the rest of
the content. For virtually all pages the behaviour of the presentation engine is fine - the browser timeouts are
sufficiently long that they will not occur for the generation of any reasonable web page request. There are a few situations however where a page can legitimately take longer that the
browser timout. Most of these pages concern site administration - a good example being a page that
uploads a catalogue file to populate the web-site with product information. In this case the processing of
the data file can consume significant periods of time. In this situation the Pattern Page must force the
Presentation Engine to send headers early to prevent the browser timeout occurring. This method forces the Presentation Engine to immediately send all headers to the browser. Note - this method only works once - the first time it is called the system sends all the
accumulated header information to that point. Subsequent calls are ignored. Causing operations
that affect the headers after calling this method are effectively ignored - the headers have already
been dispatched! In practice this means than any operations on the
rb.page.cookie object or calls to
rb.page.writeheader() must take place before
calling this method. Example The following example formats an cookie to be sent to the browser and then
forces the data to be sent to the browser before starting a lengthy operation.
<rb:script>
var data = new Object;
data.name = "Redbourne";
data.phone = "0870 166440";
rb.page.cookie.write("AppData", data);
rb.page.sendHTTPheaders();
// Now do some processing that takes a long time.
....
</rb:script>
|