Skip to content
Snippets Groups Projects
Commit 9374ecbe authored by Vincent Massol's avatar Vincent Massol
Browse files

XWIKI-20023: Move the Formula macro to XWiki Contrib

* Fix bug for URL resolving which were resolved with the file:// scheme by FOP
* I couldn't find how to tell FOP what base URI to use for URL resolving
parent 7eec9672
No related branches found
No related tags found
No related merge requests found
......@@ -274,10 +274,12 @@ private void setCacheFile(FontManager fontManager) throws InitializationExceptio
}
/**
* Use the instance base URL as the FOP base URI so that the relative URLs returned by XWiki when rendering a page
* in view mode (for browser consumption - it's a best practice to return relative URLs and let browsers convert
* them to full URLs) are properly converted by FOP to full URIs before
* {@link org.apache.xmlgraphics.io.ResourceResolver#getResource(URI)} is called.
* Use the instance base URL as the FOP base URI so that any relative URLs returned by XWiki when rendering a
* page in view mode (for browser consumption - it's a best practice to return relative URLs and let browsers
* convert them to full URLs) are properly converted by FOP to full URIs before
* {@link org.apache.xmlgraphics.io.ResourceResolver#getResource(URI)} is called. Note that we currently use
* {@link com.xpn.xwiki.web.ExternalServletURLFactory} in {@link com.xpn.xwiki.web.ExportAction} and thus all
* URLs arriving in FOP should already be absolute.
*/
private URI getBaseURI() throws InitializationException
{
......
......@@ -164,11 +164,7 @@ private String export(String format, XWikiContext context) throws XWikiException
// Note 1: exportType will be null if no office server is started or it doesn't support the passed format
// Note 2: we don't use the office server for PDF exports since it doesn't work OOB. Instead we use FOP.
if ("pdf".equalsIgnoreCase(format)) {
// Use the factory to generate view URLs for browser-consumption. FOP will resolve any relative URL to
// a full URI, see FOPXSLFORenderer#getBaseURI(). Note that this is a better implementation than using
// ExternalServletURLFactory since that would only work for URLs that are computed using XWikiURLFactory
// and not those using a ResourceReferenceSerializer (e.g. ExtendedURLTemporaryResourceReferenceSerializer).
urlFactory = new XWikiServletURLFactory();
urlFactory = new ExternalServletURLFactory();
exporter = new PdfExportImpl();
exportType = ExportType.PDF;
} else if (exportType == null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment