mirror of https://github.com/apache/jclouds.git
Issue 76: properly address UTF encoding of paths
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1843 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
6f58f153b5
commit
44eed3917f
|
@ -532,14 +532,18 @@ public class JaxrsAnnotationProcessor {
|
|||
for (Entry<Integer, Set<Annotation>> entry : indexToPathParam.entrySet()) {
|
||||
for (Annotation key : entry.getValue()) {
|
||||
Set<Annotation> extractors = indexToParamExtractor.get(entry.getKey());
|
||||
|
||||
String paramKey = ((PathParam) key).value();
|
||||
String paramValue;
|
||||
if (extractors != null && extractors.size() > 0) {
|
||||
ParamParser extractor = (ParamParser) extractors.iterator().next();
|
||||
pathParamValues.put(((PathParam) key).value(), injector.getInstance(
|
||||
extractor.value()).apply(args[entry.getKey()]));
|
||||
paramValue = injector.getInstance(extractor.value()).apply(args[entry.getKey()]);
|
||||
} else {
|
||||
String paramKey = ((PathParam) key).value();
|
||||
String paramValue = URLEncoder.encode(args[entry.getKey()].toString(), "UTF-8");
|
||||
paramValue = args[entry.getKey()].toString();
|
||||
}
|
||||
paramValue = URLEncoder.encode(paramValue, "UTF-8");
|
||||
// Web browsers do not always handle '+' characters well, use the well-supported
|
||||
// '%20' instead.
|
||||
paramValue = paramValue.replaceAll("\\+", "%20");
|
||||
for (char c : skipEncode) {
|
||||
String value = Character.toString(c);
|
||||
String encoded = URLEncoder.encode(value, "UTF-8");
|
||||
|
@ -548,7 +552,6 @@ public class JaxrsAnnotationProcessor {
|
|||
pathParamValues.put(paramKey, paramValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pathParamValues;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue