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

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

Platform Support

Jaxer Server FrameworkJaxer Client Framework
1.0no

Classes

Jaxer.Util.Url.ParsedUrl

Functions

MethodActionJaxer Server FrameworkJaxer 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 Details1.0no

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

Returns
StringThe 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 Details1.0no

Parameters
StringurlThe URL to apply this to

Returns
StringURL 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 Details1.0no

Parameters
StringstrThe source URL to decode

Returns
StringThe 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 Details1.0no

Parameters
StringstrThe string to encode

Returns
StringThe 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 Details1.0no

Parameters
ObjecthashThe object to convert to a query string

Returns
StringThe 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 Details1.0no

Parameters
StringurlThe URL to test

Returns
BooleanTrue 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 Details1.0no

Parameters
StringurlThe URL to parse

Returns
Jaxer.Util.Url.ParsedUrlThe 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 Details1.0no

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

Returns
Jaxer.Util.Url.ParsedUrlThe 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 Details1.0no

Parameters
StringqueryA query string

Returns
Object

aptana_docs