Not sure if it still helps after all this time but I've just tried to
reproduce this and I didn't manage. Loading a font with a relative URI
from the servlet context worked fine at least with the current FOP Trunk.

FOURIResolver is always used as a fallback if none of the custom
URIResolvers were able to resolve the URI.

I'm not sure what went wrong on your side. If you are using 0.92beta,
please retry with FOP Trunk (from SVN) and see what happens.

On 13.09.2006 13:28:59 Kai Mütz wrote:
> Hi,
> 
> there is an issue with ServletContextURIResolver which I do not really
> understand. It is not really a problem, because everything works fine
> excepting an error message in log file. Thus this mailing is more or less an
> information.
> 
> I initialize fop with the following code:
> 
> Fop fop = null;
> FopFactory fopFactory = FopFactory.newInstance();
> if (context != null) {
>       fopFactory.setURIResolver(new ServletContextURIResolver(context));
> }
> try {
>       if (configURI != null) {
>               try {
>                       fopFactory.setUserConfig(configURI);
>               } catch (SAXException e) {
>                       getLogger().warn("Can not set FOP user config!", e);
>               }
>       }
>       fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
> } catch (Exception e) {
>       getLogger().error("Can not create FOP instance!", e);
> }
> 
> And have configured base and font-base in conf file:
> 
> <fop version="1.0">
>   <!-- Base URL for resolving relative URLs -->
>   <base>servlet-context:/</base>
>   <font-base>servlet-context:/WEB-INF/fonts/</font-base>
>   .....´
> </fop>
> 
> 
> As mentioned above everything works fine, i.e. the images relative to base
> and the fonts relative to font-base are found. BUT if i serialize a PDF with
> an external-graphic included the following error ist logged:
> 
> ERROR (FOURIResolver.java:210) - Error with base URL "servlet-context:/"):
> unknown protocol: servlet-context
> 
> with Stacktrace:
> 
> java.net.MalformedURLException: unknown protocol: servlet-context
>         at java.net.URL.<init>(URL.java:574)
>         at java.net.URL.<init>(URL.java:464)
>         at java.net.URL.<init>(URL.java:413)
>         at
> org.apache.fop.apps.FOURIResolver.toBaseURL(FOURIResolver.java:206)
>         at org.apache.fop.apps.FOURIResolver.resolve(FOURIResolver.java:90)
>         at org.apache.fop.apps.FopFactory.resolveURI(FopFactory.java:628)
>         at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:421)
>         at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:395)
>         at
> org.apache.fop.image.ImageFactory.loadImage(ImageFactory.java:190)
>         at org.apache.fop.image.ImageLoader.loadImage(ImageLoader.java:56)
>         at
> org.apache.fop.image.ContextImageCache.getImage(ImageFactory.java:432)
>         at org.apache.fop.image.ImageFactory.getImage(ImageFactory.java:157)
>         at
> org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:68)
>         at org.apache.fop.fo.FObj.processNode(FObj.java:118)
> 
> 
> I don't know why the FOURIResolver is used here. Anyone does? Again: the
> external graphic is found.
> 
> Regards, Kai


Jeremias Maerki


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

Reply via email to