cziegeler 02/01/04 01:45:36
Modified: src/documentation/svg addlabel.xsl
src/documentation/xdocs/ctwig ctwig-why.xml
src/java/org/apache/cocoon Main.java
src/java/org/apache/cocoon/util NetUtils.java
Log:
First fix for the path encoding problem when using the CLI:
As now the links especially for images are encoded (for Netscape), they have
to be decoded when the files are written to the file system! In addition
the svg generation should also use the decoded version to generate the image.
This patch fixes most of the problems, but for some strange reasons, some
images are not generated properly.
Revision Changes Path
1.2 +2 -1 xml-cocoon2/src/documentation/svg/addlabel.xsl
Index: addlabel.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/documentation/svg/addlabel.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- addlabel.xsl 3 Jan 2002 12:31:01 -0000 1.1
+++ addlabel.xsl 4 Jan 2002 09:45:36 -0000 1.2
@@ -2,12 +2,13 @@
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:NetUtils="org.apache.cocoon.util.NetUtils"
version="1.0">
<xsl:param name="label"/>
<xsl:template match="label">
- <xsl:value-of select="$label"/>
+ <xsl:value-of select="NetUtils:decodePath($label)"/>
</xsl:template>
<xsl:template match="@*|node()">
1.2 +1 -1 xml-cocoon2/src/documentation/xdocs/ctwig/ctwig-why.xml
Index: ctwig-why.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/ctwig/ctwig-why.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ctwig-why.xml 3 Jan 2002 12:31:02 -0000 1.1
+++ ctwig-why.xml 4 Jan 2002 09:45:36 -0000 1.2
@@ -3,7 +3,7 @@
<document>
<header>
- <title>cTwIG - Cocoon Two Idiots Guide - Why?</title>
+ <title>cTwIG - Cocoon Two Idiots Guide - Why</title>
<authors>
<person name="Jeremy Aston" email="[EMAIL PROTECTED]"/>
</authors>
1.2 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Main.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Main.java 3 Jan 2002 12:31:06 -0000 1.1
+++ Main.java 4 Jan 2002 09:45:36 -0000 1.2
@@ -97,7 +97,7 @@
* Command line entry point.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:06 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/01/04 09:45:36 $
*/
public class Main {
@@ -683,7 +683,7 @@
}
// Process URI
- File file = IOUtils.createFile(destDir, filename);
+ File file = IOUtils.createFile(destDir, NetUtils.decodePath(filename));
OutputStream output = new BufferedOutputStream(new FileOutputStream(file));
String type = getPage(deparameterizedURI, parameters, translatedLinks,
output);
output.close();
1.2 +14 -4 xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java
Index: NetUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NetUtils.java 3 Jan 2002 12:31:21 -0000 1.1
+++ NetUtils.java 4 Jan 2002 09:45:36 -0000 1.2
@@ -21,7 +21,7 @@
* utility methods
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:21 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/01/04 09:45:36 $
*/
public class NetUtils {
@@ -51,14 +51,14 @@
for (i = '0'; i <= '9'; i++) {
safeCharacters.set(i);
}
-
+
// 'safe' rule
safeCharacters.set('$');
safeCharacters.set('-');
safeCharacters.set('_');
safeCharacters.set('.');
safeCharacters.set('+');
-
+
// 'extra' rule
safeCharacters.set('!');
safeCharacters.set('*');
@@ -66,13 +66,23 @@
safeCharacters.set('(');
safeCharacters.set(')');
safeCharacters.set(',');
-
+
// special characters common to http: file: and ftp: URLs ('fsegment' and
'hsegment' rules)
safeCharacters.set('/');
safeCharacters.set(':');
safeCharacters.set('@');
safeCharacters.set('&');
safeCharacters.set('=');
+ }
+
+ /**
+ * Decode a path
+ *
+ * @param path the path to decode
+ * @return the decoded path
+ */
+ public static String decodePath(String path) {
+ return java.net.URLDecoder.decode( path );
}
/**
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]