[
https://issues.apache.org/jira/browse/CXF-8553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17364526#comment-17364526
]
Nicolas Lenoire commented on CXF-8553:
--------------------------------------
Hi [~ffang],
I perfectly understand what CXF is doing and the rational of your proposed
solution according to the current behavior. What I don't understand is
# The rational for such choice of behavior. Trying to preventing double
encoding may seems a good thing at first but it inevitably fall into the issue
I'm facing and prevent an application to deal with 'xxx%20xxx' like query param
values. Wouldn't it be more reliable and consistent to assume that the
parameter value provided by user isn't encoded at all (or fully encoded) rather
than assuming that the user has maybe provided a value that is "partially
encoded"?!? I'm sorry but I really have a hard time finding a use case that
would justify this behavior and I never faced such situation. And I would even
consider this a programming error. BTW, the UrlBuilder.resolveTemplate method
do not assume any "partial encoding" from the values...
# Why this behavior isn't documented? According to me, It seems an opinionated
choice that would need to be motivated. Basically, if CXF decides to change
this behavior whereas my code base rely on it, how can I know about that and
change it accordingly?
Thanks,
Nicolas
> UriBuilder does not properly encode query parameters
> ----------------------------------------------------
>
> Key: CXF-8553
> URL: https://issues.apache.org/jira/browse/CXF-8553
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.4.3
> Reporter: Nicolas Lenoire
> Assignee: Freeman Yue Fang
> Priority: Major
>
> The JAXRS specification seems unclear regarding how the method
> {code:java}
> UriBuilder.queryParam(String name, Object… values){code}
> treats values w/ URL encoding. However, we could legitimately assume this
> method properly URL encodes parameter values.
> CXF implementation URL encodes values, but with some defects:
> invoking
> {code:java}UriBuilder.fromUri("my/path").queryParam("p",
> "%250%").toTemplate(){code}
> produces the URI template
> {code:java}
> my/path?p=%250%25 {code}
> instead of
> {code:java}
> my/path?p=%25250%25{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)