API Docs for: 0.8.0
Show:

UrlService Class

Module: Entities
Parent Module: Services

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

Methods

createSystemUrl

(
  • path
  • [options]
)
String static

Creates a fully qualified URL to the system.

Parameters:

  • path String
  • [options] Object optional
    • [locale] String optional
    • [hostname] String optional

Returns:

String:

exists

(
  • url
)
Object static

Takes the URL path and tests it against registered routes.

Parameters:

  • url String

Returns:

Object:

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 Object

    Contains the options for the function. "url" (string) and "type" (string) are required. "id" (string) is optional.

  • cb Function

    Callback function

getCustomUrl

(
  • prefix
  • url
)
String

Takes a url and extracts the wild card part.

Parameters:

  • prefix String
  • url String

Returns:

String:

The custom part of the URL

isExternalUrl

(
  • urlStr
  • request
)
Boolean

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:

Boolean:

TRUE if the link is external to the system, FALSE if not.

isFullyQualifiedUrl

(
  • urlStr
)
Boolean

Indicates if the URL is fully qualified, meaning that the URL provides the 'http' protocol at the beginning of the URL.

Parameters:

  • urlStr String

    The URL to inspect

Returns:

Boolean:

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:

String:

a URL path