|
|
WebRenderer
can be deployed within a Java Applet.
The following proceedure
is essential in securely deploying your Java applet:
1) Compile
your applet and place in a JAR file 2) Create a keystore and
digital key for signing your Applet 3) Sign all the webrenderer
jar files and your Applet JAR with your digital key 4)
Set the Applet Code base location in the HTML file
Create
an Applet:
import
java.awt.*; import java.applet.*; import javax.swing.*;
import
com.webrenderer.*;
public class AppletBrowser extends JApplet
{ IBrowserCanvas
browser; public
static void main(String[] args) { AppletBrowser
a = new AppletBrowser(); }
public
AppletBrowser() { super(); BrowserFactory.setLicenseData("30dtrial",
"TODO: Insert your 30 day key here"); browser
= BrowserFactory.spawnMozilla();
JPanel
panel = new JPanel(new BorderLayout()); panel.add(BorderLayout.CENTER,
browser.getCanvas()); this.setContentPane(panel); this.setSize(600,
500); this.show(); this.setVisible(true); browser.loadURL("http://www.google.com/"); } }
Compilation
example:
javac.exe -classpath webrenderer.jar;. AppletBrowser.java jar
cvf MyApplet.jar *.class del *.class
Digital key creation
keytool
-genkey -keystore YourKeystore -alias mystore
Digitally
sign the WebRenderer JAR and Applet JAR files
jarsigner
-keystore YourKeystore webrenderer.jar mystore jarsigner -keystore
YourKeystore MyApplet.jar mystore
Create the HTML
file with the Applet references
Please note: The webrenderer-xxx.jar
and the webrenderer.jar must be specified in the Applets classpath.
If a Mozilla spawn is used then the corecomponents-xxx.jar must
also be in the classpath.
<HTML> <APPLET
CODE="AppletBrowser.class" archive="webrenderer.jar,
webrenderer-xxx.jar,
MyApplet.jar" CODEBASE="." WIDTH=200 HEIGHT=200> <form> </APPLET> </HTML>
|