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

NameTypeOptionalDefaultDescripton
sBaseStringcheckedThe base URI
sRelStringcheckedThe URI relative to the base URI. If this describes an absolute URI then the base URI will be replaced.

Properties

NameTypegetsetDescripton
dirPathStringcheckedThis 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.
fragmentStringcheckedThis is all the text coming after (and including) the first '#' character.
hostStringcheckedThe name of the host (or domain) that the URI points at. For a mailto URI this is the part after the '@'.
hrefStringcheckedcheckedThis is the complete string representation of the URI.
pathStringcheckedThis is the part of the URI that comes after the port. It includes the file part of URI if available.
portStringcheckedThis is the port part of the URI.
queryStringcheckedThis 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.
schemeStringcheckedThe scheme is the first part of the URI and is the text before the first ':'. For example "http", "mailto" and "file" are common schemes.
userInfoStringcheckedThis 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

NameDescription
addParamAdds 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.
getParamGets 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.
getParamsReturns all the params with the given name
hasParamWhether the URI has a param with the given name
removeParamRemoves the params with the given param name
setParamSets the value for a param.

Events

None.

Static Methods

None.

Static Fields

None.

Remarks

None.

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

NameTypeOptionalDefaultDescripton
sNameStringThe name of the param
sValueStringThe 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

NameTypeOptionalDefaultDescripton
sNameStringThe name of the param

Return Type

String

getParams

Returns all the params with the given name

Syntax

object.getParams ( sName )

Parameters

NameTypeOptionalDefaultDescripton
sNameStringThe 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

NameTypeOptionalDefaultDescripton
sNameStringThe name of the param to check for

Return Type

Boolean

removeParam

Removes the params with the given param name

Syntax

object.removeParam ( sName )

Parameters

NameTypeOptionalDefaultDescripton
sNameStringThe name of the param to remove

Return Type

void

setParam

Sets the value for a param.

Syntax

object.setParam ( sName,sValue )

Parameters

NameTypeOptionalDefaultDescripton
sNameStringThe name of the param
sValueStringThe value of the param

Return Type

void