Whitebeam Template Reference Documentation

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Template Reference Documentation

System Template

HTTPreturn()

Specify an HTTP result code to return to the client.

Syntax

void = rb.page.HTTPreturn(ResultCode, ResultString)

Parameters

The 'HTTPreturn' method takes 2 parameters:

Name Type/Value Range/Length Description
ResultCodenumber  Required. Numeric HTTP result code - eg 401.
ResultStringstring  Required. Stringto return with the result.

Results

The 'HTTPreturn' method returns no useful information.

Remarks

This method allows a web author to return a specific HTTP result code to the client browser. The default successful code (200) is overridden with the result specified in this call. For example to force an Authentication Failure to the client the web author should set the result code to '401'.

The method takes two parameters - the first is the numeric HTTP result code. This must be a number. The second is a textual description of the result code. This is generally not used by the client browser but may be displayed.

This method has the same result as the rb:return tag. Note that if the Pattern Page redirects the server to another page the result code is not discarded!.

Example

The following example is sufficient to cause a client browser to display a username and password dialog box.

<rb:script> rb.page.HTTPreturn(401, "Authentication Required"); rb.page.writeheader("WWW-Authenticate", 'Basic realm="Whitebeam example"'); </rb:script>

It is NOT sufficient to simply send the authentication failed response. The client needs the addititional HTTP header to specify what authentications is required. In this case the page indicates this by calling rb.page.writeheader()

Whitebeam release 1.3.36
(loadtime : 113ms)