siamraf
07-18-2005, 12:45 PM
Hi, I'm trying to test my applet locally, but it came up with SecurityAccesExceptions when trying to access a required config file. I've been told this is because applets are prevented from accessing files not on a server, for security etc. So I stuck everything onto my local server and gave an absolute path to the file (http://localhost/config.xml). That worked, but I have 2 queries:
1) The config.xml file then refers to another config file, in a field logconfigpath, which is accessed using new file(logconfigpath) in initialisation. Problem is, apparently the file constructer cant create a File from an absolute path like http://localhost/logconfig.xml. It says it cant find it... And if I set the logconfigpath to just be the relative path of the xml (logconfig.xml), it comes up with a security exception again... What to do?
2) How does the applet know if its being run from a server or locally? I stuck everything onto my local server and tried giving xml paths relatively, and it still didnt like it. I still needed to provide its absolute path on my localserver. Does this mean when this is eventually implemented on a proper server, I'd still need to provide the file locations absolutely?
Sorry if these are really basic questions...I'm quite the beginner...
Cheers,
Siam
1) The config.xml file then refers to another config file, in a field logconfigpath, which is accessed using new file(logconfigpath) in initialisation. Problem is, apparently the file constructer cant create a File from an absolute path like http://localhost/logconfig.xml. It says it cant find it... And if I set the logconfigpath to just be the relative path of the xml (logconfig.xml), it comes up with a security exception again... What to do?
2) How does the applet know if its being run from a server or locally? I stuck everything onto my local server and tried giving xml paths relatively, and it still didnt like it. I still needed to provide its absolute path on my localserver. Does this mean when this is eventually implemented on a proper server, I'd still need to provide the file locations absolutely?
Sorry if these are really basic questions...I'm quite the beginner...
Cheers,
Siam