cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1493884 - in /cxf/branches/2.5.x-fixes: common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
Date Mon, 17 Jun 2013 18:53:23 GMT
Author: dkulp
Date: Mon Jun 17 18:53:23 2013
New Revision: 1493884

URL: http://svn.apache.org/r1493884
Log:
Fix another compile failure

Modified:
    cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java
    cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java

Modified: cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java?rev=1493884&r1=1493883&r2=1493884&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java
(original)
+++ cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/UrlUtils.java
Mon Jun 17 18:53:23 2013
@@ -20,7 +20,11 @@
 package org.apache.cxf.common.util;
 
 import java.io.UnsupportedEncodingException;
+import java.net.URI;
 import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -44,7 +48,6 @@ public final class UrlUtils {
      * Decodes using URLDecoder - use when queries or form post values are decoded
      * @param value value to decode
      * @param enc encoding
-     * @return
      */
     public static String urlDecode(String value, String enc) {
         try {
@@ -63,7 +66,6 @@ public final class UrlUtils {
      * URL path segments may contain '+' symbols which should not be decoded into ' '
      * This method replaces '+' with %2B and delegates to URLDecoder
      * @param value value to decode
-     * @return
      */
     public static String pathDecode(String value) {
         // TODO: we actually need to do a proper URI analysis here according to
@@ -77,4 +79,43 @@ public final class UrlUtils {
         return urlDecode(value);
     }
     
+    
+    /**
+     * Create a map from String to String that represents the contents of the query
+     * portion of a URL. For each x=y, x is the key and y is the value.
+     * @param s the query part of the URI.
+     * @return the map.
+     */
+    public static Map<String, String> parseQueryString(String s) {
+        Map<String, String> ht = new HashMap<String, String>();
+        StringTokenizer st = new StringTokenizer(s, "&");
+        while (st.hasMoreTokens()) {
+            String pair = st.nextToken();
+            int pos = pair.indexOf('=');
+            if (pos == -1) {
+                ht.put(pair.toLowerCase(), "");
+            } else {
+                ht.put(pair.substring(0, pos).toLowerCase(),
+                       pair.substring(pos + 1));
+            }
+        }
+        return ht;
+    }
+    
+    /**
+     * Return everything in the path up to the last slash in a URI.
+     * @param baseURI
+     * @return the trailing 
+     */
+    public static String getStem(String baseURI) {
+        URI uri = URI.create(baseURI);
+        baseURI = uri.getRawPath();
+        int idx = baseURI.lastIndexOf('/');
+        if (idx != -1) {
+            baseURI = baseURI.substring(0, idx);
+        }
+        return URI.create(baseURI).getPath();
+    }
+    
+    
 }

Modified: cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java?rev=1493884&r1=1493883&r2=1493884&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
Mon Jun 17 18:53:23 2013
@@ -35,7 +35,7 @@ import org.w3c.dom.Document;
 import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.common.util.UrlUtils
+import org.apache.cxf.common.util.UrlUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CachedOutputStream;



Mime
View raw message