TrustedServers

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

Methods

static Cesium.TrustedServers.add(host, port)

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

static Cesium.TrustedServers.clear()

清除注册表
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:
// Add server
TrustedServers.add('my.server.com', 81);

// Check if server is trusted
if (TrustedServers.contains('https://my.server.com:81/path/to/file.png')) {
    // my.server.com:81 is trusted
}
if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
    // my.server.com isn't trusted
}

static Cesium.TrustedServers.remove(host, port)

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