Whitebeam Object Definition

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 Object Definition

HttpRequest Object Description

This is a simple class that allows a Whitebeam application to send out HTTP requests to another server on the network - and then process the output from that server either textually or via the rich XML processing environment offered by Whitebeam.

More details of this feature can be found in a tutorial dealing with this specific topic.

This functionality allows applications to access the wealth of online resources available on the Internet, Intranet or Extranet. Examples of where this functionality has been used include:

  • Accessing online data-sources. Such sources may have a Simple Object Access Protocol (SOAP) or may simply be XML or HTML documents
  • Shopping cart handshaking - for example PayPal requires transactions to be acknowledged via an HTTPS post back to PayPal servers
  • Reading existing web pages and reskinning them on the fly. For example where a company has a legacy web-site comprising a lot of static pages. A 'quick' way of changing the corporate image for such a site is to run each page request through a Whitebeam Presentation Page that performs the look and feel translation.
  • Adding security to an existing insecure application. For example where you want to make an Intranet application available to authorised people over the Internet. Leave the old application behind a firewall and use the Whitebeam security architecture to encapsulate each page in a secure wrapper.

The HttpRequest class is a fairly simple basic access class that allows raw HTTP requests to be made across a network. Using this class you can build more sophisticated classes to encapsulate higher level functionality such as SOAP access.

Methods

HttpRequest.doRequest() Send a request to a remote HTTP server.
HttpRequest.toString() Return the 'body' property of this HttpRequest.

Aggregate Types

HttpRequest.HttpHeader An HTTP header comprising a name and a value pair.

Object Properties

Name Type/Value Range/Length Description
urlstring  Optional. Specify the target URL that you wish to retrieve. If you use the 'URL' parameter the 'protocol', 'host', 'port' and 'path' attributes are ignored. Format is protocol://[username:pwd@]server[:port]//path
effectiveURLstring  Optional. After a successful call to doRequest this property will contain the actual URL retrieved. If the original URL caused a redirect then this will reference the final URL server to the client (subject to maxRedirects being large enough).
protocolstring  Optional, default = HTTP
Currently 'HTTP' or 'HTTPS' (case insensitive)
hoststring  Optional. IP address or DNS name of server. Required if 'url' not specified.
portnumber  Optional, default = 80
IP port number.
pathstring  Required. Virtual path name of the resource to access.
methodstring  Optional, default = GET
"GET", "POST" etc.
proxystring  Optional. Address (name/ip address:port) of an intermediate proxy device.
proxyTypestring  Optional, default = http
String identifying the type of the optional proxy. Ignored unless 'proxy' is defined. May be 'http', 'socks4', 'socks4a' or 'socks5' (case insensitive)
maxRedirectsnumber  Optional, default = 0
By default HttpRequest makes a single request - returning everything to the caller. If you set 'maxRedirects' to a number greater than zero, Whitebeam will automatically follow redirect headers fom the origin server.
redirectCountnumber  Optional. After a request has been made this property will hold the number of redirects followed to reach the effectiveURL
autoReferbool  Optional, default = true
If 'maxRedirects' is greater than zero, when Whitebeam follows a redirect it automatically sets the referer header to the previous URL.
postdatastring  Required. The textual data to send as post-data to the server.
headersarray of struct HttpRequest.HttpHeaderssee definition Required. Set of headers to send to the server.
resnumber  Optional. This property will not exist until an HTTP request is made. Subsequently the property will hold either the HTTP response code returned from the remote server or the value -1 - indicating the server could not be contacted.
errorMessagestring  Required. Any error message returned as part of the request.
responseHeadersstruct HttpRequest.HttpHeadersee definition Optional. Set of HTTP headers in the response.
bodystring  Optional. After a successful request to a remote sever this property will contain the body of the HTTP response.
binarystring  Optional. If set to 'true' then the 'body' field will be a binary object containing the raw data returned in the request. This is useful in those cases where, for example, the HTTP request is to retieve binary data such as image.
timeoutnumber  Optional. How long to wait before a request 'times out'.
elapsednumber  Optional. Defined by HttpRequest after a successful doRequest() call. Contains the time in milli-seconds taken to service the request.
sslVerifyPeerbool  Optional, default = false
If set to 'true' and the protocol is HTTPS - Whitebeam checks the authenticity of the origin servers certificate before completing the request. If the certificate is invaid the request aborts.
sslVerifyHostbool  Optional, default = false
Implies sslVerifyPeer==true. Once the certificate has been validated, also ensure that it applies to the origin server.

Whitebeam release 1.3.36
(loadtime : 22ms)