GAE URL 获取 HTTPS 服务

GAE URL Fetch Service for HTTPS

我的应用程序抛出此错误:

[INFO] Caused by: java.lang.ClassCastException: com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection cannot be cast to javax.net.ssl.HttpsURLConnection
[INFO]  at info.modprobe.browserid.Verifier.verify(Verifier.java:76)

导致错误的代码是:

        URL verifierURL = new URL(this.url);
        String response = "";
        HttpsURLConnection connection = (HttpsURLConnection) verifierURL
                .openConnection(); // error here...
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type",
                "application/json; charset=utf-8");
        connection.setDoOutput(true);

尝试使用此 library 进行 Mozilla 个人验证时。我想知道可能是什么问题,因为 GAE URL Fetch Service 支持 HTTPS。

尝试

HttpURLConnection connection = (HttpURLConnection) verifierURL.openConnection();

而不是

HttpsURLConnection connection = (HttpsURLConnection) verifierURL.openConnection();

它将在下面创建它需要的内容,也适用于 HTTPS,但不要强制转换为 HttpS,因为它使用 class (URLFetchServiceStreamHandler$Connection) 扩展 HttpURLConnection 但不扩展 HttpsURLConnection