You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Jorg Heymans <jh...@domek.be> on 2004/10/15 17:46:41 UTC

Re: Locales problem (was Re: batik attempts to download classes from applet)

Hi Thomas,

Seems that this is not quite working yet (snapshot from last week). I 
tracked it down to a problem in Services.java, at the top where you 
declare the serviceFile, there is a leading "/" missing before "META-INF".
So the line should read
serviceFile="/META-INF/services/" + cls.getName();

With this enabled there is no attempt to download extra classes or 
properties.

For loading applet resources you need a leading "/" in the URI , there 
is probably a good reason in a spec somewhere but i haven't got that 
spec handy ;-)

Thanks!
Jorg


Thomas DeWeese wrote:
> Hi Jorg,
> 
>    Most of your issues should now be solved.
> 
>    First the dtdis.properties file is now loaded using
> Class.getResourceAsStream which should avoid the internationalization
> stuff.
> 
>    Second the InterpreterFactories are now loaded using the
> Services interface.  So there is a new file:
> resources/META-INF/services/org.apache.batik.script.InterpreterFactory
> 
>    That contains the list of InterpreterFactory classes to load and
> register.  Right now it only has the Rhino interpreter uncommented.
> It would probably be nice if the build processes tweaked this file
> properly based on the presence/absence of various jar files.  But I'm
> not good enough with Ant to do that...
> 
> Thomas DeWeese wrote:
> 
>> Hi Jorg,
>>
>>    I'm working on both of these issues.
>>
>> Jorg Heymans wrote:
>>
>>> It seems that at least the dtdids_de stuff is a problem with locales. 
>>> I tried setting the locale on the jsvgcanvas but that didn't help. I 
>>> am now getting various classes with "_de" ending that batik tries to 
>>> load from the webserver. Can i turn this off somehow?
>>>
>>> Looking at InterpreterPool.java i can understand now why it tries to 
>>> load the different interpreterfactories. However, 
>>> JPythonInterpreterFactory and JaclInterpreterFactory are only present 
>>> in the sources, not in the binary distribution. Is there any way to 
>>> tell batik not to bother to try and load different interpreters? 
>>> (other than patching the class ofcourse)
>>>
>>> Regards
>>> Jorg
>>>
>>> Jorg Heymans wrote:
>>>
>>>> Hi,
>>>>
>>>> I am running a JSVGCanvas in an applet. Upon loading and init'ing 
>>>> the applet, i can see in the accesslog of my webserver that 
>>>> "something" (guess it's the batik lib) tries to backload a few extra 
>>>> files that are not present in the applet jar.
>>>>
>>>> I copied all classes from batik-all-1.5.1.jar into my applet.
>>>>
>>>> Here are the files it tries to load :
>>>>
>>>> org/apache/batik/dom/svg/resources/dtdids.class
>>>> org/apache/batik/dom/svg/resources/dtdids_de.class
>>>> org/apache/batik/dom/svg/resources/dtdids_de.properties
>>>> org/apache/batik/dom/svg/resources/dtdids_de_DE.class
>>>> org/apache/batik/dom/svg/resources/dtdids_de_DE.properties
>>>> org/apache/batik/script/jpython/JPythonInterpreterFactory.class
>>>> org/apache/batik/script/jacl/JaclInterpreterFactory.class
>>>> META-INF/services/org.apache.batik.bridge.BridgeExtension
>>>>
>>>> Any thoughts?
>>>>
>>>> Regards
>>>> Jorg
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Thomas DeWeese <Th...@Kodak.com>.
Jorg Heymans wrote:

>>
>>
>>    Yes, except these files really should be able to be localized.
>> The Messages*.properties files store all the UI text, see,
>> java.util.ResourceBundle.
>>
> I see. But why does it try to find 
> org.apache.batik.swing.resources.Messages.class when this class is not 
> even in the archive? 

    You need to read the description of ResourceBundle, one option
is to have classes instead of properties files.

> There is a org.apache.batik.swing.Messages however.
> And if i set the locale on the canvas to English, why does it still try 
> to retrieve the OS locale message properties (ie german)?

    I would guess that we don't quite properly handle locale, so
setting it on the canvas doesn't carry through the whole system,
we end up just using the 'default' locale for the JVM.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Jorg Heymans <jh...@domek.be>.
> 
> 
>    Yes, except these files really should be able to be localized.
> The Messages*.properties files store all the UI text, see,
> java.util.ResourceBundle.
> 
I see. But why does it try to find 
org.apache.batik.swing.resources.Messages.class when this class is not 
even in the archive? There is a org.apache.batik.swing.Messages however.
And if i set the locale on the canvas to English, why does it still try 
to retrieve the OS locale message properties (ie german)?

>    It appears that there isn't a clean way to avoid this given
> the design of Applets.  What you really want to say is only check
> the contents of the Archives (jar files).  But an applet always
> has 'codebase' on the class path - so it will always attempt to
> load 'missing' files from the server (as opposed to simply
> aborting).
Agreed.


>    Why is it so bad for the Applet to request these classes? (the
> Server should respond fairly quickly with a 404).
I just like to be a bit more in control of the applet communication 
that's all :) It's not really bad behaviour on the part of the batik 
applet.

Hope this is still somehow batik relevant :)

Regards
Jorg


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Jorg,

Jorg Heymans wrote:

> Still having some symptoms of this, batik tries to download 
> org.apache.batik.swing.resources.Messages.class (and subsequently, 
> "Messages_de_DE" variants of this)
> 
> Is this the same problem as with the dtd.properties file before?

    Yes, except these files really should be able to be localized.
The Messages*.properties files store all the UI text, see,
java.util.ResourceBundle.

    It appears that there isn't a clean way to avoid this given
the design of Applets.  What you really want to say is only check
the contents of the Archives (jar files).  But an applet always
has 'codebase' on the class path - so it will always attempt to
load 'missing' files from the server (as opposed to simply
aborting).

    You might be able to do something with a subclass of ClassLoader
but I would think that it would be hard to know when it was safe
to pass a load request to a parent and when it wasn't.

    Why is it so bad for the Applet to request these classes? (the
Server should respond fairly quickly with a 404).

> 
> Regards
> Jorg
> 
> Thomas DeWeese wrote:
> 
>> Jorg Heymans wrote:
>>
>>> Is this Services API something Batik specific ?
>>
>>
>>
>>   No, it's not, it's generally called Service Provider
>> Interface:
>>
>> http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
>>
>>    Under Service Provider.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Jorg Heymans <jh...@domek.be>.
Hi Thomas,

Still having some symptoms of this, batik tries to download 
org.apache.batik.swing.resources.Messages.class (and subsequently, 
"Messages_de_DE" variants of this)

Is this the same problem as with the dtd.properties file before?

Regards
Jorg

Thomas DeWeese wrote:
> Jorg Heymans wrote:
> 
>> Is this Services API something Batik specific ?
> 
> 
>   No, it's not, it's generally called Service Provider
> Interface:
> 
> http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
> 
>    Under Service Provider.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Thomas DeWeese <Th...@Kodak.com>.
Jorg Heymans wrote:

> Is this Services API something Batik specific ?

   No, it's not, it's generally called Service Provider
Interface:

http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

    Under Service Provider.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Jorg Heymans <jh...@domek.be>.

Thomas DeWeese wrote:
> Hi Jorg,
> 
> Jorg Heymans wrote:
> 
>> Seems that this is not quite working yet (snapshot from last week). I 
>> tracked it down to a problem in Services.java, at the top where you 
>> declare the serviceFile, there is a leading "/" missing before 
>> "META-INF".
>> So the line should read
>> serviceFile="/META-INF/services/" + cls.getName();
> 
> 
> Well when I do this it doesn't find anything when running
> locally (either from jars or classes directory).
> 
>> With this enabled there is no attempt to download extra classes or 
>> properties.
> 
> 
>    Does everything still work?

yup everything still works fine AFAICS. Is this Services API something 
Batik specific ?


Regards
Jorg


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Locales problem (was Re: batik attempts to download classes from applet)

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Jorg,

Jorg Heymans wrote:

> Seems that this is not quite working yet (snapshot from last week). I 
> tracked it down to a problem in Services.java, at the top where you 
> declare the serviceFile, there is a leading "/" missing before "META-INF".
> So the line should read
> serviceFile="/META-INF/services/" + cls.getName();

Well when I do this it doesn't find anything when running
locally (either from jars or classes directory).

> With this enabled there is no attempt to download extra classes or 
> properties.

    Does everything still work?

> For loading applet resources you need a leading "/" in the URI , there 
> is probably a good reason in a spec somewhere but i haven't got that 
> spec handy ;-)



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org