Page 1 of 1

URI Resolver

PostPosted: Sat Dec 08, 2012 1:58 am
by jorsa76
I'm trying to create a docx file from an XHTML. It's creating the document but it's not using any style. When I check the log I see this:

Code: Select all
INFO: doc.css is not a URL; may be relative. Testing using parent URL file:/C:/Projects/XXX/XXX/XXX/./
07-Dec-2012 15:58:25 org.docx4j.org.xhtmlrenderer.util.JDKXRLogger log
INFO: TIME: parse stylesheets  2942ms
07-Dec-2012 15:58:25 org.docx4j.org.xhtmlrenderer.util.JDKXRLogger log
INFO: media = print
07-Dec-2012 15:58:25 org.docx4j.org.xhtmlrenderer.util.JDKXRLogger log
INFO: Requesting stylesheet: file:/C:/Projects/XXX/XXX/XXX/doc.css
07-Dec-2012 15:58:25 org.docx4j.org.xhtmlrenderer.util.JDKXRLogger log
WARNING: item at URI file:/C:/Projects/XXX/XXX/XXX/doc.css not found
07-Dec-2012 15:58:25 org.docx4j.org.xhtmlrenderer.util.JDKXRLogger log
WARNING: Couldn't parse stylesheet at URI file:/C:/Projects/XXX/XXX/XXX/doc.css: Stream closed


The problem is that everything is done in the server side and I don't have the path to the css file. It is in fact in a directory that is part of the classpath, so is there a way to specify that? Is there any way to overwrite the default URI Resolver so I can control how the resources are loaded?

Re: URI Resolver

PostPosted: Mon Dec 10, 2012 7:30 pm
by jason
http://stackoverflow.com/questions/1747 ... ucer-xhtml suggests implementing a UserAgentCallback (ie a class extending NaiveUserAgent)

Unfortunately, DocxRenderer does not currently allow user agent to be set to anything other than Docx4jUserAgent

I've created issue https://github.com/plutext/flyingsaucer/issues/3

Of course, you are welcome to submit a patch addressing this issue