Webkit tries to download Java applet class before reading it from JAR
Asked Answered
P

1

6

I'm embedding a Java applet like this:

<object type="application/x-java-applet">
  <param name="codebase" value="/path/to/jar" />
  <param name="archive" value="myapplet.jar" />' +
  <param name="code" value="my.package.MyClass" />
</object>

The applet works fine in all browsers but Webkit browsers (Chrome and Safari) are both annoying the server with a useless request which tries to download the MyClass file (Which is in the JAR and works fine from there) from the server:

Chrome shows this error in the console:

GET http://localhost/test/my.package.MyClass 404 (Not Found) 

The same happens when using the <embed> tag instead of <object> but it doesn't happen when using the deprecated <applet> tag.

Is there a possibility to prevent this class file downloading somehow? I heard rumors about a codebase_lookup parameter but setting this param to false doesn't change anything.

Penetrate answered 21/12, 2012 at 11:24 Comment(7)
If you keep control on your application, I suggest just to use the deprecated APPLET tag as it works correctly. Surely support for it may be dropped later but during that time some better solution will probably appear. Surely the things are worse if you hand the application to the your client.Cockrell
Using the applet tag is not a solution, it's a workaround. I'm hoping for an answer which maybe explains why Webkit is trying to download the class file and how to disable this behavior. Maybe it is a Webkit bug and someone knows the location of a bug report which contains more information about this issue. Who knows.Penetrate
Yes, it is a workaround, not an answer.Cockrell
Use deployJava.js for writing the applet/object element.Birdseed
Have you tried to use jar://myapplet.jar!my.package.MyClass as code? I think this should be the correct URL for classes inside a Jar. Maybe, the webkit will drop the request to a jar:// url. I am pretty unsure about this, so I don't want to give this as an answer.Conatus
Just another question: WHY don't you want to use the applet-tag?Conatus
Applet-tag is no longer supported in HTML5: w3schools.com/tags/tag_applet.aspDiplodocus
F
2

I found that this issue occurs when applet's code parameter is set in the param tag. If you move it to the corresponding object's attribute, 404 error no longer appear:

<object type="application/x-java-applet" code="my.package.MyClass">
   <param name="codebase" value="/path/to/jar" />
   <param name="archive" value="myapplet.jar" />
</object>

Tested on:

Windows 8, Java 1.7.0_25: Chrome 28, Firefox 23, IE10

OS X 10.6.8, Java 1.6.0_51: Chrome 28, Firefox 23, Safari 5.1.9

OS X 10.7.5, Java 1.7.0_25: Firefox 23, Safari 6.0.5

OS X 10.8.4, Java 1.7.0.25: Firefox 23, Safari 6.0.5

OS X 10.9, Java 1.7.0_25, Firefox 23, Safari 7.0

Franchot answered 14/8, 2013 at 3:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.