[jdom-interest] Re: Strange behaviour of applet when accessing the DTD
Bernd Eggink
Bernd.Eggink at rrz.uni-hamburg.de
Wed Oct 8 06:50:18 PDT 2003
On Wed, Oct 08, 2003 at 12:31:51PM +0200, Per Norrman wrote:
> 1. An unsigned applet can only call back to the server
> from where it was loaded, all other connections will
> be refused. Instead of hard coding the URL of yor xml
> file, build it up something like this:
>
> String host = getDocumentBase().getHost();
> URL url = new URL("http", host, "/eggink/dia.xml");
I know that, but my applet _is_ loaded from the same server. Actually,
there is only one system involved. Also, this would not explain why
the applet works on the second try.
> 2. The parser cannot locate the relative DTD location because
> you use an InputStream. Use the URL directly:
>
> Document document = new SAXBuilder(true).build(url);
Right (but I didn't have a relative DTD).
> 3. The use of localhost in DOCTYPE will not work when the
> client reading the xml file is not on the same host. The client
> will think that the DTD is on his/her/its machine. Change it to:
>
> <!DOCTYPE dialog SYSTEM "tst.dtd" >
Everything is on the same host.
> Hope this helps!
Unfortunately not. The changes you suggest cause the applet to produce
AccessControlExceptions _every_ time, even on reload. And, as I
pointed out in my previous mail, the whole thing (same XML, same DTD,
same URLs) works well with DOM.
Meanwhile I've made some more experiments, which showed that the
effect is system specific.
- On Windows XP: No problems. The applets runs fine regardless if it
is
loaded from Windows itself (using Resin 2.1.11) or from a Linux
system
(SuSE 8.2, Resin).
- On Linux: The applet _never_ works, even if loaded from the same
host.
There is no doubt about the accssibility of the XML and DTD file: I
can easily read both of them in an applet over a HTTP connection.
Any more ideas, except that this be a JDOM bug?
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
Bernd.Eggink at rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/RRZ/B.Eggink/
More information about the jdom-interest
mailing list