Home Manual Reference Source
import {UrlParser} from 'ievv_jsbase/lib/http/UrlParser'
public class | source

UrlParser

URL parser.

Example:

const urlparser = new UrlParser('http://example.com/api/people?name=Jane');
urlparser.queryString.set('search', 'doe');
// urlparser.buildUrl() === 'http://example.com/api/people?name=Jane&search=doe'

Static Method Summary

Static Public Methods
public static

pathJoin(firstPath: *, paths: *): string

Join URL paths.

Constructor Summary

Public Constructor
public

constructor(url: *)

Member Summary

Public Members
public get

domain: *

public get

path: *

public

The query-string of the the URL.

public get

scheme: *

Method Summary

Public Methods
public

Build the URL.

public

deepCopy(): *

Create a deep copy of this UrlParser object.

public

setQueryString(queryStringObject: QueryString)

Set/replace the query-string.

Static Public Methods

public static pathJoin(firstPath: *, paths: *): string source

Join URL paths.

Params:

NameTypeAttributeDescription
firstPath *

The first path. Can be an URL.

paths *

Paths to join with the first path.

Return:

string

The resulting path/url after joining.

Example:

UrlParser.pathJoin('/test', 'user/')  // == '/test/user/'
UrlParser.pathJoin('/test/', 'user/')  // == '/test/user/'
UrlParser.pathJoin('/test/', '/user/')  // == '/test/user/'
UrlParser.pathJoin('/test')  // == '/test'
UrlParser.pathJoin('http://example.com/test/', '/user/', 10) // == http://example.com/test/user/10

Public Constructors

public constructor(url: *) source

Params:

NameTypeAttributeDescription
url *

Public Members

public get domain: * source

public get path: * source

public queryString: QueryString source

The query-string of the the URL.

public get scheme: * source

Public Methods

public buildUrl(): String source

Build the URL.

Return:

String

The built URL.

public deepCopy(): * source

Create a deep copy of this UrlParser object.

Return:

*

The copy.

public setQueryString(queryStringObject: QueryString) source

Set/replace the query-string.

Params:

NameTypeAttributeDescription
queryStringObject QueryString

The QueryString object to replace the current query-string with.

Example:

const urlparser = UrlParser('http://example.com/api/people');
const querystring = new QueryString();
querystring.set('search', 'doe');
urlparser.setQueryString(querystring);
// urlparser.buildUrl() === 'http://example.com/api/people?search=doe'