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

Method Description

Binary.txlatePath()

Take a relaive pathname and run webserver translations on that name returning the resolved path

Syntax

string = Binary.txlatePath(pathname)

Parameters

The 'Binary.txlatePath' method takes 1 parameter:

Name Type/Value Range/Length Description
pathnamestring  Required.

The un-modified path name that's to be translated.


Results

The 'Binary.txlatePath' method returns string:

Type/Value Range/Length Description
string  

Remarks

Web servers typically map URLs to internal 'files' or handlers using a set of transformations.

Some of the transformations are simple. For example if the URL ends in a '/' the web server might translation this to '/index.html'.

Other transformations can be more comlpex. Apache for example provides a URL re-writing module which can take regular expressions to transform URLs to file handlers. For example:

RewriteRule ^/assets/.*$ /getAsset.rhtm/$1

will take any URLs such as 'http://server/assets/my_image.gif' and make them to the file '/getAsset.rhtm/my_image.gif'.

The rb.page.env methods provide access to the original URL, eg via rb.page.end.Path(), however there are times when it's useful to know how that URL is translated to a file handler.

Binary.txlatePath(path) provides a means to achieve this. Extending the example above:

var handlerFile = Binary.txlatePath('/assets/my_image.gif')

will return:

'/getAsset.rhtm/my_image.gif'

Whitebeam release 1.3.36
(loadtime : 9ms)