Hi Thomas,
I do know that custom class loaders are not permitted in applets but I thought that just using the applet's own class loader to call the defineClass() method may work. Of course this may also potentially mean that an applet would be able to load any class it wanted at any time simply by sending the serialised bytes from the server. I do know that this is not possible but I thought that was because the applet would still need to know the definition of such classes because the serialised objects do not contain the class definition. Given though that Rhino is actually compiling classes with definitions I still hope it's possible. I have sent a message on the Mozilla "Other Projects" mail list but there has been no reply in 2 days and no other messages on that list. I will certainly let you know if it turns out that it's possible but I am assuming the Rhino developers would have worked it out by now and would be doing it if feasible. Cheers, John From: [email protected] [mailto:[email protected]] Sent: Friday, 24 April 2009 19:51 To: [email protected] Cc: [email protected] Subject: RE: Script compilation in Batik applets Hi John, "John C. Turnbull" <[email protected]> wrote on 04/24/2009 05:32:11 AM: > This is what I suspected. However, it is possible to use the > defineClass() method of the class ClassLoader which takes a byte[] > so I would have thought that would be possible in an applet. I > realise that it would be a problem if the byte codes are saved to > disk before being loaded by the class loader but if the compilation > can be done in memory, why is it a problem? I'm not quite so certain as you that you can just call defineClass. However, I suggest you ask the Rhino folks, you have reached the end of my understanding of the issue. The Rhino API requires that we supply a classloader that implements one of their interfaces - so we need a custom class loader which is forbidden in an Applet. If you discover that it is possible to compile scripts in an applet please let us know what is involved. > > Thanks, > > John > > From: [email protected] [mailto:[email protected]] > Sent: Friday, 24 April 2009 19:21 > To: [email protected] > Cc: [email protected] > Subject: Re: Script compilation in Batik applets > > > Hi John, > > "John C. Turnbull" <[email protected]> wrote on 04/24/2009 04:01:35 AM: > > > I believe that JavaScript scripts are not able to be compiled when > > Batik is run in an applet. Why is this? Is it because Rhino can't > > do it for some reason > > Yes > > > or does it have something to do with the way Batik uses it? > > No > > When Rhino compiles scripts it generates Java Byte codes and > then loads those bytecodes via a custom classloader. Custom > classloaders are forbidden in an Applet context.
