diff --git a/applications/accounting/webapp/accounting/WEB-INF/controller.xml b/applications/accounting/webapp/accounting/WEB-INF/controller.xml
index c077e98295..29bbb96bbd 100644
--- a/applications/accounting/webapp/accounting/WEB-INF/controller.xml
+++ b/applications/accounting/webapp/accounting/WEB-INF/controller.xml
@@ -35,7 +35,7 @@ under the License.
-
+
diff --git a/applications/content/webapp/content/WEB-INF/controller.xml b/applications/content/webapp/content/WEB-INF/controller.xml
index aa937d4ccf..ba11a49929 100644
--- a/applications/content/webapp/content/WEB-INF/controller.xml
+++ b/applications/content/webapp/content/WEB-INF/controller.xml
@@ -33,7 +33,7 @@ under the License.
-
+
diff --git a/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml b/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
index f2d3c80533..d7f28f6ee3 100644
--- a/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
+++ b/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
@@ -34,7 +34,7 @@ under the License.
-
+
@@ -772,7 +772,7 @@ under the License.
-
+
diff --git a/applications/marketing/webapp/marketing/WEB-INF/controller.xml b/applications/marketing/webapp/marketing/WEB-INF/controller.xml
index cbc6f5eaaf..5883ea10d7 100644
--- a/applications/marketing/webapp/marketing/WEB-INF/controller.xml
+++ b/applications/marketing/webapp/marketing/WEB-INF/controller.xml
@@ -30,7 +30,7 @@ under the License.
-
+
diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml
index a3be260e8a..5f4bd3936c 100644
--- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml
+++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml
@@ -34,7 +34,7 @@ under the License.
-
+
diff --git a/applications/product/webapp/catalog/WEB-INF/controller.xml b/applications/product/webapp/catalog/WEB-INF/controller.xml
index b9b1ea72fb..83be95a36d 100644
--- a/applications/product/webapp/catalog/WEB-INF/controller.xml
+++ b/applications/product/webapp/catalog/WEB-INF/controller.xml
@@ -32,7 +32,7 @@ under the License.
-
+
diff --git a/applications/product/webapp/facility/WEB-INF/controller.xml b/applications/product/webapp/facility/WEB-INF/controller.xml
index e84eadf255..090af2bd9c 100644
--- a/applications/product/webapp/facility/WEB-INF/controller.xml
+++ b/applications/product/webapp/facility/WEB-INF/controller.xml
@@ -33,7 +33,7 @@ under the License.
-
+
diff --git a/framework/example/webapp/example/WEB-INF/controller.xml b/framework/example/webapp/example/WEB-INF/controller.xml
index 9ad1f8561a..6d1ab0cafc 100644
--- a/framework/example/webapp/example/WEB-INF/controller.xml
+++ b/framework/example/webapp/example/WEB-INF/controller.xml
@@ -32,7 +32,7 @@ under the License.
-
+
diff --git a/framework/widget/src/org/ofbiz/widget/screen/ScreenFopPdfViewHandler.java b/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
similarity index 88%
rename from framework/widget/src/org/ofbiz/widget/screen/ScreenFopPdfViewHandler.java
rename to framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
index f10ffd3320..0ebf614d34 100644
--- a/framework/widget/src/org/ofbiz/widget/screen/ScreenFopPdfViewHandler.java
+++ b/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
@@ -32,22 +32,27 @@ import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.FOPException;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.ofbiz.webapp.view.ApacheFopFactory;
import org.ofbiz.widget.fo.FoFormRenderer;
/**
- * Uses XSL-FO formatted templates to generate PDF views
+ * Uses XSL-FO formatted templates to generate PDF, PCL, POSTSCRIPT etc. views
* This handler will use JPublish to generate the XSL-FO
*/
-public class ScreenFopPdfViewHandler extends ScreenWidgetViewHandler {
- public static final String module = ScreenFopPdfViewHandler.class.getName();
+public class ScreenFopViewHandler extends ScreenWidgetViewHandler {
+ public static final String module = ScreenFopViewHandler.class.getName();
/**
* @see org.ofbiz.content.webapp.view.ViewHandler#render(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
+ if (UtilValidate.isEmpty(contentType)) {
+ contentType = "application/pdf";
+ }
+
// render and obtain the XSL-FO
Writer writer = new StringWriter();
@@ -69,10 +74,10 @@ public class ScreenFopPdfViewHandler extends ScreenWidgetViewHandler {
TransformerFactory transFactory = TransformerFactory.newInstance();
try {
- Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
+ Fop fop = fopFactory.newFop(contentType, out);
Transformer transformer = transFactory.newTransformer();
- // set the input source (XSL-FO) and generate the PDF
+ // set the input source (XSL-FO) and generate the output stream of contentType
Reader reader = new StringReader(writer.toString());
Source src = new StreamSource(reader);
@@ -84,21 +89,21 @@ public class ScreenFopPdfViewHandler extends ScreenWidgetViewHandler {
fw.close();
} catch (IOException e) {
throw new ViewHandlerException("Unable write to browser OutputStream", e);
- }
+ }
*/
-
+
// Get handler that is used in the generation process
Result res = new SAXResult(fop.getDefaultHandler());
try {
- // Transform the FOP XML source into a PDF, hopefully...
+ // Transform the FOP XML source
transformer.transform(src, res);
// We don't want to cache the images that get loaded by the FOP engine
fopFactory.getImageFactory().clearCaches();
// set the content type and length
- response.setContentType(MimeConstants.MIME_PDF);
+ response.setContentType(contentType);
response.setContentLength(out.size());
// write to the browser
@@ -111,7 +116,7 @@ public class ScreenFopPdfViewHandler extends ScreenWidgetViewHandler {
} catch (TransformerException e) {
Debug.logError("FOP transform failed:" + e, module );
- throw new ViewHandlerException("Unable to transform FO to PDF", e);
+ throw new ViewHandlerException("Unable to transform FO to " + contentType, e);
}
} catch (TransformerConfigurationException e) {
diff --git a/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml b/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
index dd4fd32801..f7e1332179 100644
--- a/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
+++ b/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
@@ -27,7 +27,7 @@
Asset Maintenance Component Site Configuration File
/error/error.jsp
-
+