cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r889348 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
Date Thu, 10 Dec 2009 17:59:35 GMT
Author: sergeyb
Date: Thu Dec 10 17:59:34 2009
New Revision: 889348

URL: http://svn.apache.org/viewvc?rev=889348&view=rev
Log:
Decoding form parameter names too

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=889348&r1=889347&r2=889348&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java Thu
Dec 10 17:59:34 2009
@@ -77,22 +77,22 @@
             for (String part : parts) {
                 String[] keyValue = part.split("=");
                 // Change to add blank string if key but not value is specified
+                String name = HttpUtils.urlDecode(keyValue[0]);
                 if (keyValue.length == 2) {
                     if (decode) {
-                        params.add(keyValue[0], 
-                            HttpUtils.urlDecode(keyValue[1]));
+                        params.add(name, HttpUtils.urlDecode(keyValue[1]));
                     } else {
-                        params.add(keyValue[0], keyValue[1]);
+                        params.add(name, keyValue[1]);
                     }
                 } else {
-                    params.add(keyValue[0], "");
+                    params.add(name, "");
                 }
             }
         } else if (request != null) {
             for (Enumeration en = request.getParameterNames(); en.hasMoreElements();) {
                 String paramName = en.nextElement().toString();
                 String[] values = request.getParameterValues(paramName);
-                params.put(paramName, Arrays.asList(values));
+                params.put(HttpUtils.urlDecode(paramName), Arrays.asList(values));
             }
         }
     }
@@ -110,7 +110,8 @@
             String name = cd.getParameter("name").replace("\"", "").replace("'", "");
             try {
                 String value = IOUtils.toString(a.getDataHandler().getInputStream());
-                params.add(name, decode ? HttpUtils.urlDecode(value) : value);
+                params.add(HttpUtils.urlDecode(name),
+                           decode ? HttpUtils.urlDecode(value) : value);
             } catch (IOException ex) {
                 throw new WebApplicationException(415);
             }



Mime
View raw message