Hi All
I have to fix a couple of disabled UriBuilder tests which are going to block
the next CXF release unless fixed and I'm looking at these tests and feeling
confused :-) given that it's been awhile since I was looking into the
relevant code.
The question is about dealing with ' ' and '+' in the query component of
URI.
I can see two UriBuilder tests adapted from the similar JAXRS TCK 1.1 tests,
one using the replaceQuery method and the other one - queryParam.
One test does uriBuilder.queryParam(name, "x y").build() and expects :
name=x+y.
The other one does uriBuilder.replaceQuery("name=x y").build() and expects
: name=x%20y
I think something is wrong there. Irrespectively of which method is used to
create a query component, the end result, as far as UriBuilder is concerned,
should be the same.
Now, I can see another test requirement where we do
uriBuilder.replaceQuery("name=x+y&name=%20").build()
and expect
name=x+y&name=%20
Given the build() leads to encoding % to %25, we need to decode
"name=x+y&name=%20" first, otherwise we'd get %2520 for the 2nd value of
name.
Clearly we can not decode '+' to ' ' here otherwise we'd not be able to
reproduce the original query. Which makes me think that the test which
expects "x y" be encoded as "x+y" is wrong.
So I'm thinking :
- test that does uriBuilder.queryParam(name, "x y").build() and expects :
'name=x+y' is wrong
- decoding 'x+y' to 'x y' is not required
Is it correct ?
Any clarifications will be appreciated
cheers, Sergey