TrustedServers

包含所有受信任服务器的单例。凭证将随任何对这些服务器的请求一起发送。
See:

Methods

static Cesium.TrustedServers.add(host, port)

向注册表添加受信任的服务器
Name Type Description
host string 要添加的主机。
port number 用于访问该主机的端口。
Example:
// 添加受信任的服务器
TrustedServers.add('my.server.com', 80);

static Cesium.TrustedServers.clear()

Clears the registry
Example:
// Remove a trusted server
TrustedServers.clear();

static Cesium.TrustedServers.contains(url)boolean

测试服务器是否受信任。如果URL中包含端口,则必须使用端口添加服务器。
Name Type Description
url string 要根据受信任列表进行测试的URL
Returns:
如果URL受信任则返回true,否则返回false。
Example:
// 添加服务器
TrustedServers.add('my.server.com', 81);

// 检查服务器是否受信任
if (TrustedServers.contains('https://my.server.com:81/path/to/file.png')) {
    // my.server.com:81 受信任
}
if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
    // my.server.com 不受信任
}

static Cesium.TrustedServers.remove(host, port)

从注册表中移除受信任的服务器
Name Type Description
host string 要移除的主机。
port number 用于访问该主机的端口。
Example:
// 移除受信任的服务器
TrustedServers.remove('my.server.com', 80);
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.