cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timm, Sean" <ST...@mailgo.com>
Subject [PATCH] Fix for ServletExec 2.2 getRealPath problem + Fix for Vis ualCafe 4.0 bug
Date Sun, 23 Jan 2000 08:04:01 GMT
The following diff provides the fixes to handle the problem with ServletExec
2.2 returning various kinds of slashes for getRealPath depending on the type
of URI request.  You'll also notice that I pulled the creation of the
StringTokenizer object out of each for loop.  VisualCafe 4.0 has some sort
of problem parsing the file when that line is located within the for which
made it very difficult to do any sort of debugging (even though it would
still compile...)

- Sean T.

Index: Utils.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Utils.java,v
retrieving revision 1.4
diff -u -r1.4 Utils.java
--- Utils.java	2000/01/15 11:19:17	1.4
+++ Utils.java	2000/01/23 07:57:41
@@ -138,7 +138,9 @@
         
         while (nodes.hasMoreElements()) {
             String data = ((ProcessingInstruction)
nodes.nextElement()).getData();
-            for (StringTokenizer st = new StringTokenizer(data, " \t=");
st.hasMoreTokens();) {
+            
+            StringTokenizer st = new StringTokenizer(data, " \t=");
+            for (; st.hasMoreTokens(); ) {
                 String key = st.nextToken();
                 String token = st.nextToken();
                 token = token.substring(1, token.length() - 1);
@@ -158,7 +160,8 @@
         Hashtable attributes = new Hashtable();
         
         String data = pi.getData();
-        for (StringTokenizer st = new StringTokenizer(data, " \t=");
st.hasMoreTokens();) {
+        StringTokenizer st = new StringTokenizer(data, " \t=");
+        for (; st.hasMoreTokens();) {
             String key = st.nextToken();
             String token = st.nextToken();
             token = token.substring(1, token.length() - 1);
@@ -237,7 +240,7 @@
                 return request.getPathTranslated().replace('\\','/');
             } else {
                 // otherwise use the deprecated method on all other servlet
engines.
-                return request.getRealPath(request.getRequestURI());
+                return
request.getRealPath(request.getRequestURI()).replace('\\', '/');
             }
         } catch (MalformedURLException e) {
             throw new RuntimeException("Malformed request URL.");

Mime
View raw message