lib/web/urls.js
function resolveUrl(path, options) {
    if (options === void 0) { options = {}; }
    var serverUrl = resolveServer(path, options);
    if (!serverUrl) {
        return path;
    }
    if (path.charAt(0) !== '/') {
        // construct full application url
        var tenantOrga = options.tenantOrga;
        if (!tenantOrga) {
            // following extracts the tenantOrga set on the specific server
            var serverObj = server.Server.getInstance(serverUrl);
            tenantOrga = serverObj.applyOptions({
                serverUrl: serverUrl
            }).tenantOrga;
            if (!tenantOrga) {
                tenantOrga = init.initOptions.tenantOrga;
                if (!tenantOrga) {
                    var organization = serverObj.organization;
                    if (organization) {
                        tenantOrga = organization.uniqueName;
                    }
                }
            }
        }
        var application = options.application || init.initOptions.application;
        serverUrl = url.resolve(serverUrl, '/' + tenantOrga + '/' + application + '/');
    }
    return url.resolve(serverUrl, path);
}
function resolveUrl(path, options) {
    if (options === void 0) { options = {}; }
    var serverUrl = resolveServer(path, options);
    if (!serverUrl) {
        return path;
    }
    if (path.charAt(0) !== '/') {
        // construct full application url
        var tenantOrga = options.tenantOrga;
        if (!tenantOrga) {
            // following extracts the tenantOrga set on the specific server
            var serverObj = server.Server.getInstance(serverUrl);
            tenantOrga = serverObj.applyOptions({
                serverUrl: serverUrl
            }).tenantOrga;
            if (!tenantOrga) {
                tenantOrga = init.initOptions.tenantOrga;
                if (!tenantOrga) {
                    var organization = serverObj.organization;
                    if (organization) {
                        tenantOrga = organization.uniqueName;
                    }
                }
            }
        }
        var application = options.application || init.initOptions.application;
        serverUrl = url.resolve(serverUrl, '/' + tenantOrga + '/' + application + '/');
    }
    return url.resolve(serverUrl, path);
}
function resolveUrl ( path , options ) { if ( options === void 0 ) { options = { } ; } var serverUrl = resolveServer ( path , options ) ; if ( ! serverUrl ) { return path ; } if ( path . charAt ( 0 ) !== '/' ) { // construct full application url var tenantOrga = options . tenantOrga ; if ( ! tenantOrga ) { // following extracts the tenantOrga set on the specific server var serverObj = server . Server . getInstance ( serverUrl ) ; tenantOrga = serverObj . applyOptions ( { serverUrl : serverUrl } ) . tenantOrga ; if ( ! tenantOrga ) { tenantOrga = init . initOptions . tenantOrga ; if ( ! tenantOrga ) { var organization = serverObj . organization ; if ( organization ) { tenantOrga = organization . uniqueName ; } } } } var application = options . application || init . initOptions . application ; serverUrl = url . resolve ( serverUrl , '/' + tenantOrga + '/' + application + '/' ) ; } return url . resolve ( serverUrl , path ) ; }
computes a url from a given path.

- absolute URLs are used as is, e.g.
``http://192.168.0.10:8080/mway/myapp/api/v1/some_endpoint`` stays as is,
- machine-relative URLs beginning with ``/`` are resolved against the Relution server logged
into, so that ``/gofer/.../rest/...``-style URLs work as expected, for example
``/mway/myapp/api/v1/some_endpoint`` resolves as above when logged into
``http://192.168.0.10:8080``,
- context-relative URLs such as ``api/v1/...`` are resolved using the Relution server logged in,
the ``uniqueName`` of the ``currentOrganization`` and the application name, for example
``api/v1/some_endpoint`` resolves as above when application myapp logged into
``http://192.168.0.10:8080`` using a user of organization mway provided currentOrganization
was not changed explicitly to something else.

@param path path to resolve.
@param options of server in effect.
@return {string} absolute URL of path on current server.
computes a url from a given path .