[development] [Fwd: a nasty Java applet case]
Tomas J. Fulopp
tomi at vacilando.org
Wed Oct 24 19:37:11 UTC 2007
Hi,
Anybody has any ideas about this case? I put really all details in my
mail, hoping to spark quick clues from Drupal gurus on the list. It took
me weeks to pinpoint the problem, but now I am totally stuck, wondering
what is special in Drupal that breaks the applet data loading
functionality...
Even the faintest clue might help. Please.
Tomáš / Vacilando
-------- Original Message --------
Subject: a nasty Java applet case
Date: Tue, 23 Oct 2007 21:08:55 +0200
From: Tomas J. Fulopp <tomi at vacilando.org>
Reply-To: tomi at vacilando.org
Organization: Vacilando
To: development at drupal.org
Lads and lassies, I wonder who can explain this one...
I've been working on this nasty problem for several weeks... and I am
really close to a solution now, but not quite there. Hope you can help.
It is really an interesting problem!
I maintain the "hypergraph" (HG) module, which currently takes the
current-user-visible menu and turns it into a visual map using an open
source Java applet -- see http://drupal.org/project/hypergraph or the
files in CVS here
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/hypergraph/
I have a multisite install of D5.2, the HG module sits in
http://quidne.vacilando.org/sites/all/modules/hypergraph/ folder, and
there is also the .jar file of the Java applet.
Now, when the page that contains the HG tag loads, the Java applet
appears, but it needs to call data from the server. This data is
provided by a file that resides in a folder of hypergraph, namely
http://quidne.vacilando.org/sites/all/modules/hypergraph/graphs/hg.php
(+ some arguments).
Note: in the same folder there is a .dtd file that is necessary for the
XML data.
Quite simple, really. Worked fine on other (non Drupal) sites where I
implemented it - e.g. http://www.vacilando.org frontpage
But on Drupal, and not only on my multisite install (several users
reported it), there is a silly bug: After you open the browser (FF and
IE; tested on WinXP) for the first time (with or without clearing cache,
I found), the Java applet would throw a cache-related error. When
reloaded page, and on all subsequent loads, the Java would display
correct data, without any problem.
So I looked everywhere and tried to avoid this Java error, finding that
JRE 6 has a bug related to cache, etc. Many days after I realized that
this error (after fresh opening of the browser) did not occur in other
websites I had made that feature the same applet. So I changed focus to
the generated XML data, tweaking it to perfection.. But I could not get
rid of the bug!
I then thought that perhaps I am not properly initializing Drupal. This
is in the data provider file hg.php :
drupalize();
function drupalize() {
while (!@stat('./includes/bootstrap.inc')) {
chdir ('..');
}
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
That should be fine, no? Just to be sure, I tried to put just plain XML
file here - not dynamically generated, for a test. Still the same problem!!
Then I put both files (the static test XML and the DTD file) elsewhere,
on a different subdomain ( in http://www.vacilando.org/temp/tst/ ). Wow
-- surprise -- no bug!!!!!!
Why??? Why does it not work when XML and DTD are in
http://quidne.vacilando.org/sites/all/modules/hypergraph/graphs/ and it
works when XML and DTD are in http://www.vacilando.org/temp/tst/ ? No idea!
I have a hunch - but I need your thoughts here... the XML file
definitely needs its DTD file. Could it be that something - either some
consequences of multisite, or the .htaccess rules in the root of Drupal,
or something else (what?) cause that the XML does not "see" its DTD even
though it is in the same folder..?
I tried to put an empty .htaccess file in the folder
http://quidne.vacilando.org/sites/all/modules/hypergraph/graphs/ trying
to override the basic Drupal's .htaccess - no change.
Another suspicion - the Java applet seems to be loading before the page
loads, or at least sometimes (when cache has been emptied from the
browser before it was closed). Could it be that Drupal somehow forbids
anything accessing module directories before session/cookies are set or
something?
Also tried to put the two files into a folder in the files folder ( in
http://quidne.vacilando.org/sites/quidne.vacilando.org/files/tst/ ) -
same bug.
Any idea? Anybody has experience with a similar problem?
If any of you want to test the problem in action, don't go to my website
(too many on-going dev changes), just get v1.2 from
http://drupal.org/project/hypergraph and install it ( then go to
/hypergraph ). Or contact me and I'll quickly set up a demo of the
problem on my site.
Cheers,
Tomáš / Vacilando
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20071024/df4f8e95/attachment-0001.htm
More information about the development
mailing list