[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon in path value

2020-02-11 Thread GitBox
GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon 
in path value
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1561#discussion_r378035293
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/PathProcessorCreator.java
 ##
 @@ -17,7 +17,9 @@
 
 package org.apache.servicecomb.common.rest.codec.param;
 
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Type;
+import java.net.URLDecoder;
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon in path value

2020-02-11 Thread GitBox
GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon 
in path value
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1561#discussion_r378035068
 
 

 ##
 File path: 
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java
 ##
 @@ -94,6 +97,14 @@ public static String encodePathParam(String pathParam) {
 return UrlEscapers.urlPathSegmentEscaper().escape(pathParam);
   }
 
+  public static String decodePathParam(String pathParam) throws 
UnsupportedEncodingException {
+String res = uriDecodePath(pathParam);
+if (StringUtils.isEmpty(res)) {
+  return URLDecoder.decode(pathParam, "UTF-8");
+}
+return res;
+  }
+
   public static String uriDecodePath(String path) {
 if (path == null) {
 
 Review comment:
   use `new URI(null, null, path, null);` will cause ut failed:
   
org.apache.servicecomb.common.rest.codec.param.TestPathProcessor#testGetSpaceEncoded
   
   `new URI(null, null, path, null);` can not convert '%20' to ' '


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon in path value

2020-02-11 Thread GitBox
GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon 
in path value
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1561#discussion_r378034428
 
 

 ##
 File path: 
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java
 ##
 @@ -94,6 +97,14 @@ public static String encodePathParam(String pathParam) {
 return UrlEscapers.urlPathSegmentEscaper().escape(pathParam);
   }
 
+  public static String decodePathParam(String pathParam) throws 
UnsupportedEncodingException {
+String res = uriDecodePath(pathParam);
+if (StringUtils.isEmpty(res)) {
+  return URLDecoder.decode(pathParam, "UTF-8");
 
 Review comment:
   `URLDecoder.decode(pathParam, "UTF-8")  `can not handle the '+' .
   there is a ut show that : 
org.apache.servicecomb.common.rest.codec.param.TestPathProcessor#testGetPlus.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon in path value

2020-02-09 Thread GitBox
GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon 
in path value
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1561#discussion_r376846160
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/PathProcessorCreator.java
 ##
 @@ -52,6 +54,9 @@ public Object getValue(HttpServletRequest request) {
   if (value == null) {
 return null;
   }
+  if (value.contains(":")) {
+return convertValue(URLDecoder.decode(value, "UTF-8"), targetType);
 
 Review comment:
   Add decodePathParam method.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon in path value

2020-02-07 Thread GitBox
GuoYL123 commented on a change in pull request #1561: [SCB-1748] support colon 
in path value
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1561#discussion_r376275152
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/PathProcessorCreator.java
 ##
 @@ -52,6 +54,9 @@ public Object getValue(HttpServletRequest request) {
   if (value == null) {
 return null;
   }
+  if (value.contains(":")) {
+return convertValue(URLDecoder.decode(value, "UTF-8"), targetType);
 
 Review comment:
   I notic there is a case 
org.apache.servicecomb.foundation.common.http.TestHttpUtils#uriDecode_failed
   to show a error when the param of HttpUtils.uriDecodePath contain ":".
   
   I think modify  the HttpUtils.uriDecodePat will change the previous  logic.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services