gmazza 2004/03/15 21:25:16
Modified: src/java/org/apache/fop/apps Driver.java FOFileHandler.java
InputHandler.java XSLTInputHandler.java
src/java/org/apache/fop/image ImageFactory.java
Log:
Code changed to set the Base URL in FOUserAgent, which allows
image.ImageFactory to use this value in order to determine locations
of images given relative to the input source file.
e.g. c:\xml-fop>fop examples\fo\basic\images.fo images.pdf
will now run correctly.
Revision Changes Path
1.54 +1 -1 xml-fop/src/java/org/apache/fop/apps/Driver.java
Index: Driver.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Driver.java 1 Mar 2004 23:50:26 -0000 1.53
+++ Driver.java 16 Mar 2004 05:25:16 -0000 1.54
@@ -248,7 +248,6 @@
if (userAgent == null) {
userAgent = new FOUserAgent();
userAgent.enableLogging(getLogger());
- userAgent.setBaseURL("");
}
return userAgent;
}
@@ -572,6 +571,7 @@
public synchronized void render(InputHandler inputHandler)
throws FOPException {
XMLReader parser = inputHandler.getParser();
+ userAgent.setBaseURL(inputHandler.getBaseURL());
render(parser, inputHandler.getInputSource());
}
1.3 +7 -2 xml-fop/src/java/org/apache/fop/apps/FOFileHandler.java
Index: FOFileHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/FOFileHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FOFileHandler.java 27 Feb 2004 17:39:05 -0000 1.2
+++ FOFileHandler.java 16 Mar 2004 05:25:16 -0000 1.3
@@ -45,6 +45,12 @@
*/
public FOFileHandler(File fofile) {
this.fofile = fofile;
+ try {
+ baseURL =
+ new
File(fofile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
}
/**
@@ -55,7 +61,6 @@
this.foURL = url;
}
-
/**
* @see org.apache.fop.apps.InputHandler#getInputSource()
*/
1.10 +10 -0 xml-fop/src/java/org/apache/fop/apps/InputHandler.java
Index: InputHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/InputHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- InputHandler.java 27 Feb 2004 17:39:05 -0000 1.9
+++ InputHandler.java 16 Mar 2004 05:25:16 -0000 1.10
@@ -39,6 +39,16 @@
*/
public abstract InputSource getInputSource();
+ protected String baseURL = null;
+
+ /**
+ * Get the base URL associated with this input source
+ * @return the input source
+ */
+ public String getBaseURL() {
+ return baseURL;
+ }
+
/**
* Get the SAX parser associated with this input handler.
* @return the SAX parser
1.13 +15 -4 xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java
Index: XSLTInputHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XSLTInputHandler.java 27 Feb 2004 17:39:05 -0000 1.12
+++ XSLTInputHandler.java 16 Mar 2004 05:25:16 -0000 1.13
@@ -57,6 +57,12 @@
public XSLTInputHandler(File xmlfile, File xsltfile, Vector params) throws
FOPException {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ try {
+ baseURL =
+ new
File(xmlfile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
xsltParams = params;
}
@@ -70,6 +76,12 @@
public XSLTInputHandler(File xmlfile, File xsltfile) throws FOPException {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ try {
+ baseURL =
+ new
File(xmlfile.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
}
/**
@@ -144,11 +156,10 @@
saxTFactory.newXMLFilter(xsltSource);
/* if (inParams != null) {
- Transformer transformer = ??? how to obtain from an XMLFilter?
- int nParams = inParams.size();
-
+ // parameters currently not settable with an XMLFilter
for (int i = 0; i < nParams; i += 2) {
- transformer.setParameter((String) inParams.elementAt(i),
+ // setParameter() method doesn't exist
+ xmlfilter.setParameter((String) inParams.elementAt(i),
(String) inParams.elementAt(i + 1));
}
}
1.5 +1 -0 xml-fop/src/java/org/apache/fop/image/ImageFactory.java
Index: ImageFactory.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/ImageFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ImageFactory.java 27 Feb 2004 17:47:46 -0000 1.4
+++ ImageFactory.java 16 Mar 2004 05:25:16 -0000 1.5
@@ -219,6 +219,7 @@
// Get the absolute URL
URL absoluteURL = null;
InputStream in = null;
+
try {
in = ua.getStream(href);
} catch (IOException ioe) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]