UrlService Class
A service that provides insight into the system's routes (URLs) along with other utility functions to assist in examining and constructing URLs for clients to use for interaction with the system.
Constructor
UrlService
()
Item Index
Methods
Methods
createSystemUrl
-
path
-
[options]
Creates a fully qualified URL to the system.
Parameters:
-
path
String -
[options]
Object optional-
[locale]
String optional -
[hostname]
String optional
-
Returns:
exists
-
url
Takes the URL path and tests it against registered routes.
Parameters:
-
url
String
Returns:
The themed route specification for the first route that matches the given URL path. When no routes match NULL is returned.
existsForType
-
params
-
cb
Look at a specific content type to see if a matching URL key exists. An optional ID can be provided to ensure that only an existing key for the object with that ID exists.
Parameters:
-
params
ObjectContains the options for the function. "url" (string) and "type" (string) are required. "id" (string) is optional.
-
cb
FunctionCallback function
getCustomUrl
-
prefix
-
url
Takes a url and extracts the wild card part.
Parameters:
-
prefix
String -
url
String
Returns:
The custom part of the URL
isExternalUrl
-
urlStr
-
request
Determines whether a URL is external to the system by parsing the URL and then looking to see if the host matches that of the provided request.
Parameters:
-
urlStr
String -
request
Request
Returns:
TRUE if the link is external to the system, FALSE if not.
isFullyQualifiedUrl
-
urlStr
Indicates if the URL is fully qualified, meaning that the URL provides the 'http' protocol at the beginning of the URL.
Parameters:
-
urlStr
StringThe URL to inspect
Returns:
TRUE if fully qualified, FALSE if not
urlJoin
()
String
Takes a variable set of arguments and joins them together to form a URL path.
Returns:
a URL path