Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides an read-only model representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

The read-only model (frozen) is easier for debugging than exposing accessors for each property. ICloneable<Uri> is not used to prevent unnecessary copying of values that won't change.

Hierarchy

  • Uri

Implements

Index

Constructors

constructor

  • new Uri(scheme: SchemeValue, userInfo: string, host: string, port: number, path: string, query?: QueryParam.Convertible, fragment?: string): Uri
  • Parameters

    • scheme: SchemeValue

      The user name, password, or other user-specific information associated with the specified URI.

    • userInfo: string

      The host component of this instance.

    • host: string

      The port number of this URI.

    • port: number

      The absolute path of the URI.

    • path: string

      The absolute path of the URI.

    • Optional query: QueryParam.Convertible

      Any query information included in the specified URI.

    • Optional fragment: string

      The escaped URI fragment.

    Returns Uri

Properties

absoluteUri

absoluteUri: string

The absolute URI.

authority

authority: string

Gets the Domain Name System (DNS) host name or IP address and the port number for a server.

baseUri

baseUri: string

Gets the full path without the query or fragment.

fragment

fragment: string

host

host: string

path

path: string

pathAndQuery

pathAndQuery: string

Gets the path and Query properties separated by a question mark (?).

port

port: number

query

query: string

queryParams

queryParams: IMap<Primitive | Primitive[]>

scheme

scheme: SchemeValue

userInfo

userInfo: string

Accessors

pathSegments

  • get pathSegments(): string[]

Methods

copyTo

  • Parameters

    Returns IUri

equals

  • equals(other: IUri): boolean
  • Compares the values of another IUri via toString comparison.

    Parameters

    Returns boolean

Protected getAbsoluteUri

  • getAbsoluteUri(): string
  • Is provided for sub classes to override this value.

    Returns string

Protected getAuthority

  • getAuthority(): string
  • Is provided for sub classes to override this value.

    Returns string

Protected getPathAndQuery

  • getPathAndQuery(): string
  • Is provided for sub classes to override this value.

    Returns string

toMap

  • Creates a writable copy.

    Returns IUri

toString

  • toString(): string
  • Returns string

    The full absolute uri.

updateQuery

  • updateQuery(query: QueryParam.Convertible): Uri
  • Parameters

    • query: QueryParam.Convertible

    Returns Uri

Static copyOf

  • Parameters

    Returns IUri

Static from

  • Parses or clones values from existing Uri values.

    Parameters

    • uri: string | IUri
    • Optional defaults: IUri

    Returns Uri

Static getAuthority

  • getAuthority(uri: IUri): string
  • Returns the authority segment of an URI.

    Parameters

    Returns string

Static parse

  • parse(url: string, throwIfInvalid?: boolean): IUri
  • Parses a URL into it's components.

    Parameters

    • url: string

      The url to parse.

    • Default value throwIfInvalid: boolean = true

      Defaults to true.

    Returns IUri

    Returns a map of the values or null if invalid and throwIfInvalid is false.

Static toString

  • toString(uri: IUri): string
  • Properly converts an existing URI to a string.

    Parameters

    Returns string

Static tryParse

  • tryParse(url: string, out: function): boolean
  • Parses a URL into it's components.

    Parameters

    • url: string

      The url to parse.

    • out: function

      A delegate to capture the value.

        • (result: IUri): void
        • Parameters

          Returns void

    Returns boolean

    True if valid. False if invalid.

Generated using TypeDoc