I have to test the speed after loading the .gz file in browser and I am having java applet based web application(Hello word) whose HelloWorld.jar file size is 743byets and using pack200 tool compressed to .gz(321 bytes)files.
1) created HelloWorld.java file
import java.applet.Applet; import java.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello word!", 50, 25); } }
Created HelloWorld123.jar file with this class
2)Main html file hello.html
HTML Code:<HTML> <head> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta HTTP-EQUIV="Expires" CONTENT="-1"> <meta HTTP-EQUIV="accept-encoding" CONTENT="gzip,deflate"> <meta http-equiv="content-type" content="text/html"> </head> <BODY> Here is the output of my program: <APPLET CODE = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar" WIDTH = "200" HEIGHT = "50"> <param name="java_arguments" value="-Djnlp.packEnabled=true"/> </APPLET> </BODY> </HTML>
3)First time tried to load the class file from the jar file it works fine(HelloWorld.class is loading in the browser).
HTML Code:<APPLET CODE = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar" WIDTH = "200" HEIGHT = "50">
4) created different .gz file with same jar file(pack200 tool).
HelloWorld123.gz
pack200 --gzip -E9 HelloWorld123.gz HelloWorld123.jar
HelloWorld123.jar.pack
pack200 --no-gzip -E9 HelloWorld123.jar.pack HelloWorld123.jar
HelloWorld123.jar.pack.gz
pack200 --gzip -E9 HelloWorld123.jar.pack.gz HelloWorld123.jar
and tried these files with the above html code
HTML Code:<APPLET CODE = "HelloWorld.class" ARCHIVE = "HelloWorld123.gz" WIDTH = "200" HEIGHT = "50" >
or
HTML Code:<APPLET CODE = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar.pack" WIDTH = "200" HEIGHT = "50" >
or
HTML Code:<APPLET CODE = "HelloWorld.class" ARCHIVE = "HHelloWorld123.jar.pack.gz" WIDTH = "200" HEIGHT = "50" >
while loading this class I found that class loader error on sun console(as follows).
liveconnect: Invoking JS method: document liveconnect: Invoking JS method: URL basic: Referencing classloader: sun.plugin.ClassLoaderInfo@23d275, refcount=1 basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@e85825 basic: Loading applet ... basic: Initializing applet ... basic: Starting applet ... basic: completed perf rollup network: Connecting [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url] with proxy=DIRECT network: Connecting socket://localhost:7020 with proxy=DIRECT network: Connecting [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url] with cookie "JSESSIONID=gGsmMJmbGmZhtyKTn1v2FWvcRkFhN18Dpm81R2RLM6LYvYfFLf25!-726539454" network: Downloading resource: [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url] Content-Length: 314 Content-Encoding: null load: class HelloWorld.class not found. java.lang.ClassNotFoundException: HelloWorld.class at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) basic: Exception: java.lang.ClassNotFoundException: HelloWorld.class Ignored exception: java.lang.ClassNotFoundException: HelloWorld.class
In the About detail I can get that HelloWorld123.pack.gz or HelloWorld123.jar.gz or HelloWorld123.jar.pack.gz is downloading.
My question is will browser decompress the .gz file to .jar file internally ? or I am missing some coding for .gz file decompression ?.