这样当然不行。要使用URL类
URL ssoURL = null;
HttpURLConnection httpCon = null;
try{
ssoURL = new URL(ssoURLAdd);
httpCon = (HttpURLConnection)ssoURL.openConnection();
httpCon.connect();
InputStream is = httpCon.getInputStream();
/************************************/
这里就可以使用获得的 InputStream 了
/************************************/
}
}catch(MalformedURLException murle){
System.out.println("SSO Verify URL MalformedURLException :" + murle.toString());
}catch(ProtocolException pe){
System.out.println("SSO Verify URL ProtocolException :" + pe.toString());
}catch(IOException ioe){
System.out.println("SSO Verify URL IOException :" + ioe.toString());
}
URL ssoURL = null;
HttpURLConnection httpCon = null;
try{
ssoURL = new URL(ssoURLAdd);
httpCon = (HttpURLConnection)ssoURL.openConnection();
httpCon.connect();
InputStream is = httpCon.getInputStream();
/************************************/
这里就可以使用获得的 InputStream 了
/************************************/
}
}catch(MalformedURLException murle){
System.out.println("SSO Verify URL MalformedURLException :" + murle.toString());
}catch(ProtocolException pe){
System.out.println("SSO Verify URL ProtocolException :" + pe.toString());
}catch(IOException ioe){
System.out.println("SSO Verify URL IOException :" + ioe.toString());
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货