[Yanel-commits] rev 27018 -
public/yanel/trunk/src/contributions/resources/pdf/src/java/org/wyona/yanel/impl/resources
simon at wyona.com
simon at wyona.com
Wed Aug 29 14:13:51 CEST 2007
Author: simon
Date: 2007-08-29 14:13:50 +0200 (Wed, 29 Aug 2007)
New Revision: 27018
Modified:
public/yanel/trunk/src/contributions/resources/pdf/src/java/org/wyona/yanel/impl/resources/PDFResource.java
Log:
added yanel-path property. reviewed by jonathan.
Modified: public/yanel/trunk/src/contributions/resources/pdf/src/java/org/wyona/yanel/impl/resources/PDFResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/pdf/src/java/org/wyona/yanel/impl/resources/PDFResource.java 2007-08-29 09:17:10 UTC (rev 27017)
+++ public/yanel/trunk/src/contributions/resources/pdf/src/java/org/wyona/yanel/impl/resources/PDFResource.java 2007-08-29 12:13:50 UTC (rev 27018)
@@ -37,6 +37,7 @@
//import org.apache.fop.messaging.MessageHandler;
import java.io.File;
+import java.io.InputStream;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
@@ -77,7 +78,14 @@
defaultView.setResponse(false); // This resource writes directly into the response output stream
try {
- Repository repo = getRealm().getRepository();
+ String yanelPath = getResourceConfigProperty("yanel-path");
+ Repository repo = getRealm().getRepository();
+ InputStream docSource;
+ if (yanelPath != null) {
+ docSource = repo.getNode(yanelPath).getInputStream();
+ } else {
+ docSource = repo.getNode(getPath()).getInputStream();
+ }
// Step 1: Construct a FopFactory
// (reuse if you plan to render multiple documents!)
@@ -99,7 +107,7 @@
org.xml.sax.XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
xmlReader.setEntityResolver(new org.apache.xml.resolver.tools.CatalogResolver());
- Source src = new SAXSource(xmlReader, new org.xml.sax.InputSource(repo.getInputStream(new Path(getPath()))));
+ Source src = new SAXSource(xmlReader, new org.xml.sax.InputSource(docSource));
Result res = new SAXResult(fop.getDefaultHandler());
More information about the Yanel-commits
mailing list