The easiest thing is probably to hack URLBuilder (again) and define an
interface (or use URIResolver or EntityResolver) that lets you do custom
URI resolution. Then you create an implementation of that interface for
both deployment variants so you can use logical names (URIs) for the
resources and map them to their effecting URLs. Or might even go as far
as hack into the code to provide custom InputStreams based on URI like
we do now in FOP trunk.

The error message "(no !/ in spec)" should be obvious, not? You need to
begin the in-JAR-part after the "!" with a slash, i.e. an absolute path.
http://java.sun.com/j2se/1.4.2/docs/api/java/net/JarURLConnection.html

On 08.08.2005 15:16:00 Peter Verhoye wrote:
> Hi there,
> 
> First already thanks for helping me with my previous question. I've 
> found the solution. Seems a collegue of mine made a dirty fix to one of 
> his problems. The project on which I work consists of two clients: a fat 
> (swing) and a web. The swing app is deployed using Java Webstart.
> 
> Now, since our fonts are located in a jar file, and due to webstart 
> (according to my collegue) which prohibits you to load from a specific 
> jar file, he had 'overriden' the FontInfo class and decide not to use 
> the URLBuilder but to use an other method (code shown):
> public URL getMetricsFile() throws FOPException {
>   try {
>    return this.getClass().getResource(metricsFile);
>    // return URLBuilder.buildURL(Configuration.getFontBaseURL(), 
> metricsFile);
>   } catch (Exception e) {
>    throw new FOPException("Invalid font metrics file: " + metricsFile
>                      + " (" + e.getMessage() + ")");
>   }
> }
> 
> But since I was doing my test on Linux in a shell, this seemed to fail. 
> Anyway, on to the next problem.
> 
> As said, we have a jar file which is both used in the fat client and the 
> web client. In this jar, the fonts are to be found in fonts/metrics/... 
> and fonts/truetype/...
> 
> Now, I've found a post that says that if you want to load a font from a 
> jar, you should use:
> jar:file:///home/peter/fop/fop-0.20.5/lib/labeling.jar!fonts/metrics/arial.xml
> or something like this.
> 
> Now, my problem is that when I use the above statement in my userconfig 
> (again I'm testing in a shell with no fontBaseDir or baseDir set in the 
> userconfig), I get an error that says:
> Failed to read a font metrics file: Invalid font metrics file: 
> jar:file:///home/peter/fop/fop-0.20.5/lib/labeling.jar!fonts/metrics/arial.xml
>  
> (no !/ in spec)
> 
> I've also tried variations but the result goes from other Exceptions to 
> the same error. Anyway, what I would like to have is a solutions where 
> the userconfig may be different for each deployment (fat or web) but 
> that the fonts are in a jar file and are found :-)


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to