From: "Georgia Liu" <liu@georgia.larc.nasa.gov>
Message-Id: <9706050846.ZM1037@georgia.larc.nasa.gov>
Date: Thu, 5 Jun 1997 08:46:58 -0400
To: java-security@web2.javasoft.com
Subject: Does netscape browser allow Java applet to read URL?
Helper,
I have to two questions:
1) My applet trys to read url file. With appletviewer it works fine but not
with
netscape browser. Is there any way I can work around not opening a socket?
2) It that any way to the URL is valid in Java? I have following code to check
the URL is valid, but it is not working right.
Thanks a lot,
public boolean URLexist(String urlstr)
{
boolean flag = false;
if (urlstr != null)
{
try {
URL url = new URL(urlstr);
DataInputStream stream = null;
stream = new DataInputStream(url.openStream());
flag = true;
//try {
//url.openConnection().getContent();
//flag = true;
//}
}
catch (IOException e)
{
Alert.runAlertInternally(Alert.warningImage(),urlstr,
"is not exist","OK",null,null);
flag = false;
}
}
return flag;
}
-- Georgia Liu