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()

清空注册表
Example:
// Remove a trusted server
TrustedServers.clear();

static Cesium.TrustedServers.contains(url)boolean

测试一个服务器是否被信任。服务器必须在包含端口的情况下被添加到信任列表中。
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:
// 移除一个受信任的服务器
TrustedServers.remove('my.server.com', 80);
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.