I have a jax-rs service which receives a set of parameters in the path, pathparameters. These parameters may be strings containing values not suitable for urls, so they are urle
The automatic encoding of pathparams works as expected. The problem was that %20
is used to encode spaces in the url itself, while +
is used to encode the query string(the part after the ?). Pathparams are really parts of the URL, so %20 should be used.
Using URI.toAsciiString()
instead of UrlEncoder.encode(...)
and passing the different parts gives a valid url that is decoded correctly.