connecting to url using applet
Hi,
I made a console program that uses the httpURLConnection class to determine if a site is up.
Now I converted that program into an applet. It no longer works. I get the following exception when trying to connect to google:
java.security.AccessControlException: access denied (java.net.SocketPermission www.google.ca resolve)
Does this have to do with signed applets? Is there anyway, I can connect to the site to determine if it's up?
My code:
URL url = new URL (u);
HttpURLConnection con = null;
if (url.getProtocol().equals("https"))
con=(javax.net.ssl.HttpsURLConnection)url.openConnection();
else
con = (HttpURLConnection)url.openConnection();
if (con.getResponseCode() != 200)
{
throw new Exception(u + " is " + con.getResponseMessage() + " " + con.getResponseCode());
}
else
{ //do stuff }
Any help would be appreciated.
Thanks
AJ

