Hey guys,
I wasn't completely sure if this would be a Java or JS topic, but I thought it had more to do with Ajax and whatnot. Anyway, I have an embedded and signed Java applet on my page like so:
<applet style="position :absolute;left:-1px" code="fileSaver .class" archive="Signed FileSaver.jar" width="1" height="1"></applet>
this applet's jar is signed, and it requests to get file access privilages. the actual function is called from an external javascript, like so:
document.applet s[0].saveFile("clas ses.xml", data);
The source code for the file saver is as so:
import java.io.*;
import java.lang.*;
public class fileSaver extends java.applet.App let {
public int saveFile(String filename, String data) {
try {
File file=new File(filename);
if (file.exists()) {
file.delete();
}
file.createNewF ile();
System.out.prin tln(data);
FileOutputStrea m fileio = new FileOutputStrea m(file);
fileio.write(da ta.getBytes());
fileio.close();
return 1;
} catch (Exception x) {
x.printStackTra ce();
return 0;
}
}
}
The problem is, even after I accept the signiture, the browser won't allow the privilaged action of the applet. Is this maybe because I haven't signed the javascript file? If it is, how exactly do I sign it? I looked around, but nothing actually told me how to sign a js file. Thanks in advance.
jin
I wasn't completely sure if this would be a Java or JS topic, but I thought it had more to do with Ajax and whatnot. Anyway, I have an embedded and signed Java applet on my page like so:
<applet style="position :absolute;left:-1px" code="fileSaver .class" archive="Signed FileSaver.jar" width="1" height="1"></applet>
this applet's jar is signed, and it requests to get file access privilages. the actual function is called from an external javascript, like so:
document.applet s[0].saveFile("clas ses.xml", data);
The source code for the file saver is as so:
import java.io.*;
import java.lang.*;
public class fileSaver extends java.applet.App let {
public int saveFile(String filename, String data) {
try {
File file=new File(filename);
if (file.exists()) {
file.delete();
}
file.createNewF ile();
System.out.prin tln(data);
FileOutputStrea m fileio = new FileOutputStrea m(file);
fileio.write(da ta.getBytes());
fileio.close();
return 1;
} catch (Exception x) {
x.printStackTra ce();
return 0;
}
}
}
The problem is, even after I accept the signiture, the browser won't allow the privilaged action of the applet. Is this maybe because I haven't signed the javascript file? If it is, how exactly do I sign it? I looked around, but nothing actually told me how to sign a js file. Thanks in advance.
jin
Comment