Z
zorci
Hi,
I wonder why
a) applet classes are (sometimes) requested twice and
b) Component/JComponent classes are requested although never needed at
runtime.
Please take a look at the following simple SCE:
=== TestApplet.java ===
import java.awt.Applet;
public class TestApplet extends Applet {
TestObject o;
public void init() {
try {Class.forName("foo");}
catch (ClassNotFoundException e) {}
}
void neverCalled() {
add(o);
}
}
=== TestObject.java ===
import java.awt.Component;
public class TestObject extends Component {}
=== test.html ===
<html><body><applet code="TestApplet.class" width=100 height=100></
applet></body></html>
As you can see, TestObject never gets instanciated, and neverCalled()
is never called. The class.forName() is just for tracing the actions
in the access logfile. Putting each file into one web directory,
compiling and calling test.html results in my case (IE6 or Firefox,
SUN Java plugin 1.5.0_11 with disabled cache) in
.... "GET /web/test.html HTTP/1.1" 304 ...
.... "GET /web/TestApplet.class HTTP/1.1" 200 561 ...
.... "GET /web/TestObject.class HTTP/1.1" 200 200 ...
.... "GET /web/TestApplet.class HTTP/1.1" 200 561 ...
.... "GET /web/foo.class HTTP/1.1" 404 330 ...
In my opinion, requests three and four are _not_necessary_ and slow
down applet startup time. Switching to the JApplet/JComponent does not
make any difference.
Could anybody give me a hint why TestApplet.class is requested twice
and even TestObject.class is requested although not needed at runtime?
Any help is greatly appreciated.
I wonder why
a) applet classes are (sometimes) requested twice and
b) Component/JComponent classes are requested although never needed at
runtime.
Please take a look at the following simple SCE:
=== TestApplet.java ===
import java.awt.Applet;
public class TestApplet extends Applet {
TestObject o;
public void init() {
try {Class.forName("foo");}
catch (ClassNotFoundException e) {}
}
void neverCalled() {
add(o);
}
}
=== TestObject.java ===
import java.awt.Component;
public class TestObject extends Component {}
=== test.html ===
<html><body><applet code="TestApplet.class" width=100 height=100></
applet></body></html>
As you can see, TestObject never gets instanciated, and neverCalled()
is never called. The class.forName() is just for tracing the actions
in the access logfile. Putting each file into one web directory,
compiling and calling test.html results in my case (IE6 or Firefox,
SUN Java plugin 1.5.0_11 with disabled cache) in
.... "GET /web/test.html HTTP/1.1" 304 ...
.... "GET /web/TestApplet.class HTTP/1.1" 200 561 ...
.... "GET /web/TestObject.class HTTP/1.1" 200 200 ...
.... "GET /web/TestApplet.class HTTP/1.1" 200 561 ...
.... "GET /web/foo.class HTTP/1.1" 404 330 ...
In my opinion, requests three and four are _not_necessary_ and slow
down applet startup time. Switching to the JApplet/JComponent does not
make any difference.
Could anybody give me a hint why TestApplet.class is requested twice
and even TestObject.class is requested although not needed at runtime?
Any help is greatly appreciated.