Flying Saucer not resolving Images or CSS on ubuntu tomcat6
I am running into an issue with the Grails Pdf plugin which uses Flying Saucer. Everything works as expected until I deploy onto an Ubuntu server running Tomcat6. Then references in my gsp's to css and images fail, though I still get the PDF to render.
I have tried two different approaches to building the PDF
ITextRenderer renderer = new ITextRenderer()
renderer.setDocument(url)
renderer.setDocumentFromString(content, baseUri)
Running a war with 'grails prod run-war' works, running and a dummy app with no security works locally, but fails when I deploy it on the server as well. (though none of the content I am trying to render is secured anyway), the URL's of the images are correct. (I have tried both absolute and relative URL's) neither gets rendered in the PDF, but if you request those resources from a browser they are there. References to images not hosted on the server do work.
All this leads me to believe that the tomcat6 that gets installed with ubuntu when you do sudo apt-get install tomcat6
is configured funny somehow. I know that it runs with user 'tocat6' instead of 'root' as many installations do. Could that be ca开发者_如何学Cusing Flying Saucer to somehow not have the right access to get at the files being referenced?
Since everything except the images/css is working, I guess your baseURI is not correct?! I have this code on a production system and it is working. All the images are referenced absolut:
renderer.setDocument(doc, request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort());
What is your baseURI set to?
精彩评论