RestEasy Client encodes the path parameters with white chars incorrectly.
SCENARIO to reproduce:
1. Using RestEasy Client call a REST method with a path parameter. Set the value of this path parameter to:
'something something'
2. Display/trace the decoded value of this parameter on the server side.
RESULT: The displayed path parameter on the server side is incorrect and different than the original one.
'something%20something'
EXPECTED RESULT:
The displayed, decoded path parameter should be 'something something'!
SOLUTION:
I found the suspected code in the class: ./resteasy-jaxrs-1-1/resteasy-jaxrs/src/main/java/org/jboss/resteasy/specimpl/UriBuilderImpl.java
ORIGINAL CODE:
//protected StringBuffer replaceParameter(String name, String value, boolean isEncoded, String string, StringBuffer buffer)
//{
// Matcher matcher = PathHelper.URI_PARAM_PATTERN.matcher(string);
// while (matcher.find())
//
// matcher.appendTail(buffer);
// return buffer;
//}
PROPOSED CODE:
//protected StringBuffer replaceParameter(String name, String value, boolean isEncoded, String string, StringBuffer buffer)
//{
// Matcher matcher = PathHelper.URI_PARAM_PATTERN.matcher(string);
// while (matcher.find())
// {
// String param = matcher.group(1);
// if (!param.equals(name)) continue;
//
// if (!isEncoded)
// else
// value = Encode.encodeNonCodes(value);
// matcher.appendReplacement(buffer, value);
// }
// matcher.appendTail(buffer);
// return buffer;
//}
The example project containing a simple echo server and test reproducing the problem is attached. It can be build using maven.