I have an update concerning my attempt to implement the screenshot capturing functionality on the client side using a signed applet. Please do bear with me if I am committing any obvious mistakes in my solution, as I have barely scratched the surface of Applet based Java programming.
These were the steps I followed:
a.) I first converted the Java class which is supposed to take a screenshot of the client's workstation and save it as a JPG in a pre-determined location, into an applet by extending the Applet class
b.) Then, I packaged this class into a jar file and signed it with a standard keystore
c.) I put this jar into the 'lib' folder of the root directory of my web application, and added the applet using the <applet> tag on the
JSP page where it was needed
d.) I then wrote a JScript file with a function to call a public method present this applet (takeScreenShot()) [inspired by
THIS ARTICLE], and stored in in the 'js' folder of the root directory of the my web application (This file also contains code to call a VBScript function [present in a separate .vbs file of course] to send the screenshot taken as an attachment in an e-mail by firing up Outlook)
e.) I created a link which calls upon the JScript function to do the above. Of course, I added references to the JScript and VBScript files in my JSP page
So, after setting up all this, I tested my application and here are the results:
The applet got added successfully to the page, though I would prefer it to be invisible to the user (i.e. when the applet fired, it took up a blank area on the JSP page, which I would like to avoid since it has no GUI). The security certificate showed up as well, and I OKed it.
On clicking the link on the page, the JScript was fired, but IE returned an error on the page. The error was:
Error: Path does not exist. Make sure the path is correct.
Code: 4096 Now, the JScript does get fired and calls on the VBScript sucessfully because Outlook does open up, though the new e-mail message is not created. This is because the takeScreenShot() method of the applet apparently is not doing it's job, and the VBScript is not finding the screenshot where it's supposed to be.
I'd like to know whether I need to sign the applet or modify its code in a different way such that when the user OKs the certificate, it can have access to the local file system. I am leaving all the lifecycle methods in the applet blank. All it has currently is a takeScreenShot() method which will behave the same way as a normal Java class.
I'd also like to know if an Applet can be added and its methods can be accessed without actually making it take up space on the JSP page (After the security certificate is OKed and the applet control activated, it doesn't take up space anymore...but is there a way to avoid this as well?)
Thank you everyone.
[ June 25, 2008: Message edited by: Sridhar Venkataraman ]
[ June 26, 2008: Message edited by: Sridhar Venkataraman ]