English中文

TrustedServers

包含所有受信任服务器的单例。凭证将随任何请求一起发送到这些服务器。 A singleton that contains all of the servers that are trusted. Credentials will be sent with any requests to these servers.
另见: See:

方法 Methods

static Cesium.TrustedServers.add(host, port)

将受信任的服务器添加到注册表中 Adds a trusted server to the registry
名称 Name 类型 Type 说明 Description
host string 要添加的主机。 The host to be added.
port number 用于访问主机的端口。 The port used to access the host.
示例: Example:
// Add a trusted server
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 中包含服务器,则必须已添加端口。 Tests whether a server is trusted or not. The server must have been added with the port if it is included in the url.
名称 Name 类型 Type 说明 Description
url string 要根据受信任列表进行测试的 url The url to be tested against the trusted list
返回: Returns:
如果 url 可信,则返回 true,否则返回 false。 Returns true if url is trusted, false otherwise.
示例: 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)

从注册表中删除受信任的服务器 Removes a trusted server from the registry
名称 Name 类型 Type 说明 Description
host string 要删除的主机。 The host to be removed.
port number 用于访问主机的端口。 The port used to access the host.
示例: 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.