Jaxer.Util.Url : Object
Return to: Jaxer Framework index

Namespace that holds functions and other objects for working with URLs.

Platform Support

Jaxer Server Framework Jaxer Client Framework
1.0 no

Functions

Method Action Jaxer Server Framework Jaxer Client Framework
static combine(String ...) : String
Combines any number of URL fragments into a single URL, using / as the separator. Before joining two fragments with the separator, it strips any existing separators on the fragment ends to be joined
Show Details 1.0 no

Parameters
String ... Takes any number of string URL fragments

Returns
String The fragments joined into a URL

static ensureFileProtocol(String url) : String
If the given URL is already a file-type URL, it's returned untouched. Otherwise we turn it into a file-type URL by prefixing it with "file://"
Show Details 1.0 no

Parameters
String url The URL to apply this to

Returns
String URL expressed as a file type URL

static formUrlDecode(String str) : String
Decode a URL by replacing +'s with spaces and all hex values (%xx) with their character value
Show Details 1.0 no

Parameters
String str The source URL to decode

Returns
String The resulting URL after all hex values have been converted

static formUrlEncode(String str) : String
Encode a URL by replacing all special characters with hex values (%xx)
Show Details 1.0 no

Parameters
String str The string to encode

Returns
String The resulting URL after special characters and spaces have been encoded

static hashToQuery(Object hash) : String
Converts an object's properties and property values to a string suitable as a query string. Each property name becomes a key in the query string and each property value becomes the key value. A key and its value are separated by the '=' character. Each key/value pair is separated by '&'. Note that each value is encoded so invalid URL characters are encoded properly.
Show Details 1.0 no

Parameters
Object hash The object to convert to a query string

Returns
String The resulting query string

static isFile(String url) : Boolean
Tests whether the given URL is a reasonable file URL rather than something that's available over the network.The test is pretty simplistic: the URL must start with file://, resource://, or chrome://, or it must contain a backslash (i.e. a Windows filesystem separator)
Show Details 1.0 no

Parameters
String url The URL to test

Returns
Boolean True if a reasonable file URL, false otherwise

static parseUrl(String url) : Jaxer.Util.Url.ParsedUrl
Parse a string containing a URL into a Jaxer.Util.Url.ParsedUrl object to allow manipulation of the individual URL component parts
Show Details 1.0 no

Parameters
String url The URL to parse

Returns
Jaxer.Util.Url.ParsedUrl The parts of a URL broken down into useful pieces

static parseUrlComponents(String hostAndPort, String absolutePath, [String protocol]) : Jaxer.Util.Url.ParsedUrl
Create a Util.Url.ParsedUrl object from the component pieces provided as parameters to the functions calls.
Show Details 1.0 no

Parameters
String hostAndPort The host (and port, if any) containing the given path
String absolutePath The absolute path to a resource on the host
String protocol (optional)The protocol ('http' or 'https'); the default is 'http'

Returns
Jaxer.Util.Url.ParsedUrl The parts of a URL broken down into useful pieces

static queryToHash(String query) : Object
Divides the key/value pairs in a query string and builds an object for these values. The key will become the property name of the object and the value will become the value of that property
Show Details 1.0 no

Parameters
String query A query string

Returns
Object

aptana_docs