BiUri

This class is used to define a Universal Resource Identifier (URI). This is sometimes also known as a Uniform Resource Locator (URL). A URI is used to describe the location and source of external files. A URI is only a representation of the string format describing the URI. It does not know how to lookup the information the URI might point at.

A general URI has the following format. Below this is a list of what part of the URI maps to what property.

http://user:password@www.domain.com:80/dir/file.html?param0=value=0;param1=value1#fragment

scheme - http
userInfo - user:password
host - www.domain.com
port - 80
path - /dir/file.html
dirPath - /dir/
query - ?param0=value=0;param1=value1 fragment - #fragment
getParam("param0") - value0
getParam("param1") - value1
href - http://user:password@www.domain.com:80/dir/file.html?param0=value=0;param1=value1#fragment

This class extends BiObject and therefore all methods and fields available for BiObject are also available for BiUri .

Constructor

new BiUri ( [ sBase [ ,sRel ] ] )

Parameters

Name Type Optional Default Descripton
sBase String checked The base URI
sRel String checked The URI relative to the base URI. If this describes an absolute URI then the base URI will be replaced.

Properties

Name Type get set Descripton
dirPath String checked This is the part of the URI discribing the directory and it does not include the file name. This ends with a '/' if the path is available.
fragment String checked This is all the text coming after (and including) the first '#' character.
host String checked The name of the host (or domain) that the URI points at. For a mailto URI this is the part after the '@'.
href String checked checked This is the complete string representation of the URI.
path String checked This is the part of the URI that comes after the port. It includes the file part of URI if available.
port String checked This is the port part of the URI.
query String checked This is all the text coming after (and including) the first '?' character. If the URI has a fragment the fragment is not included in the query.
scheme String checked The scheme is the first part of the URI and is the text before the first ':'. For example "http", "mailto" and "file" are common schemes.
userInfo String checked This is the part of the URI used to describe the user information. This is the part coming after the scheme but before the domain. This is empty when no user information is available.

Methods

Name Description
addParam Adds a param with a given name and value. This is similar to setParam except that it does not overwrite existing paramaters with the same name.
getParam Gets the value for a param. This returns undefined if the param is not present. This returns null if the param is present but it does not have a value associated with it.
getParams Returns all the params with the given name
hasParam Whether the URI has a param with the given name
removeParam Removes the params with the given param name
setParam Sets the value for a param.

Events

None.

Static Methods

None.

Static Fields

None.

Remarks

Method Details

addParam

Adds a param with a given name and value. This is similar to setParam except that it does not overwrite existing paramaters with the same name.

Syntax

object.addParam
 (
 sName,sValue
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the param
sValue String The value of the param

Return Type

void

getParam

Gets the value for a param. This returns undefined if the param is not present. This returns null if the param is present but it does not have a value associated with it.

Syntax

object.getParam
 (
 sName
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the param

Return Type

String

getParams

Returns all the params with the given name

Syntax

object.getParams
 (
 sName
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the params to get.

Return Type

String[]

hasParam

Whether the URI has a param with the given name

Syntax

object.hasParam
 (
 sName
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the param to check for

Return Type

Boolean

removeParam

Removes the params with the given param name

Syntax

object.removeParam
 (
 sName
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the param to remove

Return Type

void

setParam

Sets the value for a param.

Syntax

object.setParam
 (
 sName,sValue
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the param
sValue String The value of the param

Return Type

void