You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2017/11/09 08:25:36 UTC

svn commit: r1814708 - in /ofbiz/ofbiz-framework/trunk/framework/webapp: config/fop.properties src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java

Author: deepak
Date: Thu Nov  9 08:25:36 2017
New Revision: 1814708

URL: http://svn.apache.org/viewvc?rev=1814708&view=rev
Log:
Improved: Use FlexibleLocation.resolveLocation to resolve the fop.path and fop.font.base.url (OFBIZ-9974)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/webapp/config/fop.properties
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/config/fop.properties
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/config/fop.properties?rev=1814708&r1=1814707&r2=1814708&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/config/fop.properties (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/config/fop.properties Thu Nov  9 08:25:36 2017
@@ -18,13 +18,13 @@
 ###############################################################################
 
 #Set fop.xconf path
-fop.path=/framework/webapp/config
+fop.path=component://webapp/config
 
 #Set default font family
 fop.font.family=NotoSans
 
 #Set font base url
-fop.font.base.url=/framework/webapp/config/
+fop.font.base.url=component://webapp/config/
 
 ###############################################################################
 # FOP Encryption Parameters

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java?rev=1814708&r1=1814707&r2=1814708&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ApacheFopWorker.java Thu Nov  9 08:25:36 2017
@@ -105,14 +105,16 @@ public final class ApacheFopWorker {
                 }
 
                 try {
-                    String ofbizHome = System.getProperty("ofbiz.home");
-                    File userConfigFile = FileUtil.getFile(ofbizHome + fopPath + "/fop.xconf");
+                    URL configFilePath = FlexibleLocation.resolveLocation(fopPath + "/fop.xconf");
+                    File userConfigFile = FileUtil.getFile(configFilePath.getFile());
                     if (userConfigFile.exists()) {
                         fopFactory = FopFactory.newInstance(userConfigFile);
                     } else {
                         Debug.logWarning("FOP configuration file not found: " + userConfigFile, module);
                     }
-                    File fontBaseFile = FileUtil.getFile(ofbizHome + fopFontBaseProperty);
+                    URL fontBaseFileUrl = FlexibleLocation.resolveLocation(fopFontBaseProperty);
+                    File fontBaseFile = FileUtil.getFile(fontBaseFileUrl.getFile());
+
                     if (fontBaseFile.isDirectory()) {
                         fopFactory.getFontManager().setResourceResolver(ResourceResolverFactory.createDefaultInternalResourceResolver(fontBaseFile.toURI()));
                     } else {