cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject cxf git commit: [CXF-6853]:Support encoded value in @ApplicationPath
Date Wed, 30 Mar 2016 12:57:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 444b61678 -> 30158d39a


[CXF-6853]:Support encoded value in @ApplicationPath


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/30158d39
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/30158d39
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/30158d39

Branch: refs/heads/master
Commit: 30158d39a699d01f9d7344dd9cd15dd98e683bc5
Parents: 444b616
Author: Jim Ma <ema@apache.org>
Authored: Wed Mar 30 20:57:24 2016 +0800
Committer: Jim Ma <ema@apache.org>
Committed: Wed Mar 30 20:57:24 2016 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/30158d39/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
index e945943..05b3538 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
@@ -22,6 +22,7 @@ package org.apache.cxf.jaxrs.utils;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -499,6 +500,15 @@ public final class HttpUtils {
     public static String getPathToMatch(String path, String address, boolean addSlash) {
         
         int ind = path.indexOf(address);
+        try {
+            String decodeAddr = URLDecoder.decode(address, "UTF-8");
+            if (ind == -1 && !address.equals(decodeAddr)) {
+                address = decodeAddr;
+                ind = path.indexOf(address);
+            }
+        } catch (UnsupportedEncodingException e) {
+            //
+        }
         if (ind == -1 && address.equals(path + "/")) {
             path += "/";
             ind = 0;


Mime
View raw message