Reputation: 35276
My app is throwing this error:
[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)
And the code causing the error is:
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);
When trying to do Mozilla Personal Verification using this library. I wonder what could be the problem since GAE URL Fetch Service supports HTTPS.
Upvotes: 4
Views: 730
Reputation: 1750
Try
HttpURLConnection connection = (HttpURLConnection) verifierURL.openConnection();
instead of
HttpsURLConnection connection = (HttpsURLConnection) verifierURL.openConnection();
It will create what it needs underneath, also for HTTPS, but don't force the cast to HttpS, because it uses a class (URLFetchServiceStreamHandler$Connection) taht extends HttpURLConnection but not HttpsURLConnection
Upvotes: 4