<OBJECT> tag and applet caching

  • Thread starter james.a.cleland
  • Start date
J

james.a.cleland

I'm sure this has been answered before, but I cannot find where. I've
recently switched from using <APPLET> to <OBJECT> for embedding my
java applets. During development, I would like to be able to disable
caching of my applets. It's not convenient to develop the applet as a
java application. I'm developing in Eclipse and serving the applet via
JSP. I need it to reload every time.

Here's what I have so far. The applet is communicating with the
servlet via ObjectInput/OutputStream and they share a jar which
defines data objects. The jars are available to the browser from the /
applets path. The below WORKS, but my applet is still cached. Using
IE7. Thanks for your input.

<object classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5-windows-
i586.cab#Version=5,0,0,5"
WIDTH = "200" HEIGHT = "200" >
<PARAM NAME = CODE VALUE = "path.to.my.applet.class" >
<PARAM NAME = CODEBASE VALUE = "/applets" >
<param name = "type" value = "application/x-java-
applet;version=1.5">
<param name = "scriptable" value = "false">
<PARAM NAME = "cache_option" VALUE="No" >
<PARAM NAME = "cache_archive" VALUE = "applet.jar,dataobj.jar">
</object>
 
W

Wayne

I'm sure this has been answered before, but I cannot find where. I've
recently switched from using <APPLET> to <OBJECT> for embedding my
java applets. During development, I would like to be able to disable
caching of my applets. It's not convenient to develop the applet as a
java application. I'm developing in Eclipse and serving the applet via
JSP. I need it to reload every time.

Here's what I have so far. The applet is communicating with the
servlet via ObjectInput/OutputStream and they share a jar which
defines data objects. The jars are available to the browser from the /
applets path. The below WORKS, but my applet is still cached. Using
IE7. Thanks for your input.

<object classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5-windows-
i586.cab#Version=5,0,0,5"
WIDTH = "200" HEIGHT = "200" >
<PARAM NAME = CODE VALUE = "path.to.my.applet.class" >
<PARAM NAME = CODEBASE VALUE = "/applets" >
<param name = "type" value = "application/x-java-
applet;version=1.5">
<param name = "scriptable" value = "false">
<PARAM NAME = "cache_option" VALUE="No" >
<PARAM NAME = "cache_archive" VALUE = "applet.jar,dataobj.jar">
</object>


I don't know of any mainstream browser that doesn't cache applets.
There's nothing you can do about it.

I suggest you avoid object tags and go back to applet tags. The
object tags don't work correctly from a MS IIS server (the web page
will fail to load with nested object tags). Applet tags are supported
on all servers I know of.

For development, use "appletviewer" to test your applets. It has a menu
for reload/restart the applet.

-Wayne
 
A

Arne Vajhøj

Wayne said:
I suggest you avoid object tags and go back to applet tags. The
object tags don't work correctly from a MS IIS server (the web page
will fail to load with nested object tags). Applet tags are supported
on all servers I know of.

Could you explain how object/applet tags depends on HTTP server ?

Both HTML and JAR files are just some bytes seen from the web server
perspective only client side knows what those bytes are.

Or at least that is how I understand it.

Arne
 
R

Roedy Green

I don't know of any mainstream browser that doesn't cache applets.
There's nothing you can do about it.

Browsers load the Applet class. Getting rid of it is the same as the
problem as getting rid of a class you have loaded. All you really can
do is start up a class loader to load the new version of it and wait
for the old one to die of lack of references.
 
W

Wayne

Arne said:
Could you explain how object/applet tags depends on HTTP server ?

Both HTML and JAR files are just some bytes seen from the web server
perspective only client side knows what those bytes are.

Or at least that is how I understand it.

Arne

Yeah, that's what I thought. Apparently this is a bug in IIS that
Microsoft knows about for years now, but refuses to fix. What
happens is you get an ASP error:

Active Server Pages error 'ASP 0139'
Nested Object

even if your file extension is .htm or .html. IIS scans
pages and refuses to serve a page with (perfectly legal)
nested object tags! Even though it was MS that pushed the
w3c to use object and not applet tags. I guess this is
part of the MS business model to break Java.

My school uses IIS, they won't switch to Apache for some reason.
I've tried! But that's how I found all this out.

The work-around is to use IE conditional comments to hide
the nested tags. But since applet tags work perfectly well,
even if not approved by w3c, I suggest using it.

Maybe HTML 5 will add back the applet tag, I believe they are
adding the embedded tag officially.

-Wayne
 
W

Wayne

For development, use "appletviewer" to test your applets. It has a menu
for reload/restart the applet.

-Wayne

I should add that if you must use W3C complient HTML, you should still
develop using the applet tag. When ready to deploy you can use
the "htmlconverter" application (part of the JDK) that converts
applet tags to about 20 lines of broswer/server detecting
JavaScript, object, applet, and embed tags, and will work for any browser.

-Wayne
 
J

james.a.cleland

Thanks for the discussion on this. Unfortunately, my implementation
depends on the JSP and I'm making use of Liveconnect, so I can't use
the applet viewer and test normally.

Having said that, my solution is to x-c in the Java console to clear
this cache. This works without unloading the JVM and while the applet
is running. It looks like the browser isn't caching any applets. At
least my browser cache doesn't contain any, although I do regularly
use half a dozen, so it must be the JRE. Anyway, clearing through the
console solves my problem.

Also, I have tried HtmlConverter.exe. What a mess of output! Couldn't
we just keep <APPLET>?

Thanks again for your replies.

J
 
R

Roedy Green

The work-around is to use IE conditional comments to hide
the nested tags. But since applet tags work perfectly well,
even if not approved by w3c, I suggest using it.

Since Object tags are warfare to destroy Java, and since <applet tags
work fine, and since Object tags are impossible to maintain or
proofread, I suggest ignoring them. They have only one virtue. See
http://mindprod.com/jgloss/applet.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top