hi everyone!!!
Heres a code to link to an Https site and read the contents of it.But i get an ClassCastExcept ion...Pls help me out as to whyI m getting this error and ..how can it be rectified....
URL aURL;
char ch;
Security.addPro vider(new com.sun.net.ssl .internal.ssl.P rovider());
System.setPrope rty("java.proto col.handler.pkg s","com.sun.net .ssl.internal.w ww.protocol");
aURL = new URL(null,defaul tURL, new com.sun.net.ssl .internal.www.p rotocol.https.H andler());
HttpsURLConnect ion urlConn = (HttpsURLConnec tion)aURL.openC onnection();
System.out.prin tln("before URL");
System.out.prin tln("after new URL");
System.out.prin tln("after openconnction") ;
BufferedReader in = new BufferedReader( new InputStreamRead er(urlConn.open Stream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.prin tln(inputLine);
in.close();
Heres a code to link to an Https site and read the contents of it.But i get an ClassCastExcept ion...Pls help me out as to whyI m getting this error and ..how can it be rectified....
URL aURL;
char ch;
Security.addPro vider(new com.sun.net.ssl .internal.ssl.P rovider());
System.setPrope rty("java.proto col.handler.pkg s","com.sun.net .ssl.internal.w ww.protocol");
aURL = new URL(null,defaul tURL, new com.sun.net.ssl .internal.www.p rotocol.https.H andler());
HttpsURLConnect ion urlConn = (HttpsURLConnec tion)aURL.openC onnection();
System.out.prin tln("before URL");
System.out.prin tln("after new URL");
System.out.prin tln("after openconnction") ;
BufferedReader in = new BufferedReader( new InputStreamRead er(urlConn.open Stream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.prin tln(inputLine);
in.close();
Comment