按照官方论坛说话,已经配置了服务器信任,但是没有效果
override suspend fun handleNetworkAuthenticationChallenge(challenge: NetworkAuthenticationChallenge): NetworkAuthenticationChallengeResponse {
return when (challenge.networkAuthenticationType) {
is NetworkAuthenticationType.ServerTrust -> {
LogUtil.e(challenge.toJson())
//配置信任所有签名文件
NetworkAuthenticationChallengeResponse.ContinueWithCredential(ServerTrust)
}
else -> {
NetworkAuthenticationChallengeResponse.Cancel
}
}
}
}
这样配置以后,下面代码依旧会抛异常
"https://xx.xx.xx.xx:20001/geoserver/gwc/service/wmts?layer=workspace%3Agansu_desert&style=lzz-desert&tilematrixset=EPSG%3A4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix=EPSG%3A4326%3A6"
val wmtsLayer = WmtsLayer(url2, "workspace:Agansu_desert", "EPSG:A4326", TileImageFormat.Png)
lifecycleScope.launch {
wmtsLayer.load()
wmtsLayer.loadStatus.collect {
LogUtil.e(it)
}
}