chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1368411 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
Date Thu, 02 Aug 2012 10:51:24 GMT
Author: fmui
Date: Thu Aug  2 10:51:23 2012
New Revision: 1368411

URL: http://svn.apache.org/viewvc?rev=1368411&view=rev
Log:
AtomPub and Browser binding server: never let the Container decode...

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java?rev=1368411&r1=1368410&r2=1368411&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
Thu Aug  2 10:51:23 2012
@@ -19,8 +19,10 @@
 package org.apache.chemistry.opencmis.server.shared;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Method;
 import java.math.BigInteger;
+import java.net.URLDecoder;
 import java.util.Locale;
 import java.util.Map;
 
@@ -138,13 +140,24 @@ public class HttpUtils {
     /**
      * Splits the path into its fragments.
      */
-    public static String[] splitPath(HttpServletRequest request) {
-        String p = request.getPathInfo();
-        if (p == null) {
+    public static String[] splitPath(final HttpServletRequest request) {
+        int prefixLength = request.getContextPath().length() + request.getServletPath().length();
+        String p = request.getRequestURI().substring(prefixLength);
+
+        if (p.length() == 0) {
             return new String[0];
         }
 
-        return p.substring(1).split("/");
+        String[] result = p.substring(1).split("/");
+        for (int i = 0; i < result.length; i++) {
+            try {
+                result[i] = URLDecoder.decode(result[i], "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                // should not happen
+            }
+        }
+
+        return result;
     }
 
     // -------------------------------------------------------------------------



Mime
View raw message