xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abel Braaksma <abel.onl...@xs4all.nl>
Subject Re: Help! URI for fo:external-graphic in web service
Date Mon, 07 Jan 2008 02:29:23 GMT
Jerome Munchenberg wrote:
> Hello,
> I am developing a web service which returns a PDF generated by FOP
> (fop-0.94) which must include an image. The web service is deployed as
> an EAR to a WebLogic server, and the image to be inserted into the PDF
> is contained within this EAR.

You might try the JAR scheme, but I am not sure whether that scales well 
to a EAR. Another option is to use the real filepath (you can get the 
real unpacked EAR location through your web application server 
interface, I believe), or a relative path (often it is quite easy to get 
the WEB-INF directory and go from there).

If all fails, the next easiest thing to do is to use the public URI 
which would also be accessible from your website to retrieve that same 
file. It is probably best to use localhost as server to prevent an extra 
server roundtrip.

If you don't like any of these scenarios because of their lack of 
scalability, start using Catalogs (see OASIS website) and use a 
URIResolver (possibly with a specific scheme) to resolve the catalogs 
unambiguously regardless the platform / system / paths your services are 
running on.

> How do I correctly access the image embedded in the EAR? I have been
> able to use a file file path when testing on my own box, but this is
> obviously unsuitable for other environments!

You were lucky that it worked, because if a file path is allowed, than 
that's a bug in the FOP implementation: XSL-FO prescribes that only a 
URI is allowed. To go from a filepath to a URI you should rewrite it 
something like "file:///c:/project/scr/certificate.gif" (note the 
forward slashes!).

> src="C:\Project\src\au\com\aaa\services\certificate.gif"

-- Abel Braaksma

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

View raw message