2013年12月1日星期日

[ 100 seeking help ! Questions about the program to simulate ] HTTPS requests on BAE

Local operating normally casts will appear after errors
the deployment project to BAE


                String requestUrl = "https://api.weibo.com/2/statuses/update.json";
                try {
                    URL url = new URL(requestUrl);
                    HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection(); //这句报错


/ / error prompt
java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

After View BAE BAE documentation found using OpenJDK 6
I use a local sun jdk 6
at BAE on openConnection () returns an instance of sun.net.www.protocol.http.HttpURLConnection
local returns the instance javax.net.ssl.HttpsURLConnection

not sun.net.www.protocol.http.HttpURLConnection local class can not find the corresponding packet access under this package
This package is not openjdk will own it ?
How do I resolve this problem ?
------ Solution ---------------------------------------- ----
send HTTPS requests through a custom interface to achieve X509TrustManager certificate Manager , let us trust the specified certificate .
------ For reference only -------------------------------------- -
can tell me how to solve this problem is it? Novice, do not understand, have encountered the same problem.

没有评论:

发表评论