- From: Jeremias Maerki <dev@jeremias-maerki.ch>
- Date: Wed, 17 Feb 2010 09:42:21 +0100
- To: www-xsl-fo@w3.org
What's the goal? To access images bundled with the web application? In that case I'd define a private kind of URI which you handle within a URIResolver that uses getClass().getClassLoader().getResourceAsStream(.... to access the files. You can then use the URIResolver for both XSLT and FO transformations. An XML Catalog can help during development. See also: - http://markmail.org/message/mxv4lx562lyhexza (private URIResolver) - http://markmail.org/message/i7nvi65adokdemxu (XML Catalog with FOP) On 17.02.2010 09:29:50 Paulo Carvalho wrote: > Hello > > Thanks for your answer. > No, the image is in the correct path and the name is also correct. The image > is on a Jar file named App.jar and has the name logo.gif. It is on the "img" > path into the jar file. > > When I set the systemId on the StreamSource, the value is: > > jar:file:/D:/Programs/apache-tomcat-6.0.24/webapps/MyWS/WEB-INF/lib > /App.jar!/ > > (Code: > > String sss = this.getClass().getClassLoader().getResource("img/cnpf.gif").toExternalForm(); > > int idxl = sss.lastIndexOf("/"); > String subs1 = sss.substring(0, idxl); > int idxl2 = subs1.lastIndexOf("/"); > String subs2 = subs1.substring(0, idxl2+1); > System.out.println("subs2: " + subs2); > > streamSource.setSystemId(subs2); > > Transformer foTrans = tFactoryXML2FO.newTransformer(streamSource); > > ... > > ) > > Note1: The problem only occurs when I build a war on my web service and i > deploy it using the command line, on my tomcat server. > If i use eclipse to deploy my web service, the problem does not occur. The > image is found into the jar file. > > Note2: when my web service is deployed without using eclipse, the problem > occurs. But if i put the img folder on the tomcat root directory, the image > is found. > > > > Thank you > > Regards > > > On Wed, Feb 17, 2010 at 9:22 AM, Dave Pawson <dave.pawson@gmail.com> wrote: > > > On 17 February 2010 08:11, Paulo Carvalho <pjcarvalho@gmail.com> wrote: > > > Hello again > > > Just for info, I was using fop093 and I switched to fop095, but without > > any > > > improvements. > > > The application still cant find the image... > > > > Or the image isn't in the relative location that you specify? > > Have you tried an absolute reference? > > > > > > regarsd > > > > > > > > > > -- > > Dave Pawson > > XSLT XSL-FO FAQ. > > Docbook FAQ. > > http://www.dpawson.co.uk > > > > > > -- > Paulo Carvalho > 1 rue du Chateau > 57710 Aumetz > France > http://forum-informatico.forumeiros.com/index.htm > http://ummundoecologico.blogspot.com Jeremias Maerki
Received on Wednesday, 17 February 2010 08:42:50 UTC