[ 
https://issues.apache.org/jira/browse/CXF-6015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14140441#comment-14140441
 ] 

Daniel commented on CXF-6015:
-----------------------------

Of course you're right ';' is a valid character in a path and does not 
necessarily need to be escaped. But If I use a ClientProxy and call the service 
via its interface, I probably don't want to escape my parameters as I don't 
have any knowledge (or at least _should not rely on any knowledge_) of the 
underlying implementation.

That is given the following client code

{code}
public static void main(String[] args) throws Exception {
    DummyService service = JAXRSClientFactory.create(
        "http://localhost:9090/cxf-test-service-0.1/cxf-test";,
        DummyService.class);
    System.out.println(service.getAttributes("R¨diger", "R&uml%3Bdiger"));
}
{code}

I would expect that the implementation of the service is called with the two 
parameters {{R¨diger}} and {{R&uml%3Bdiger}}. Currently the 
implementation receives {{R&uml}} and {{R¨diger}} which I think is 
very confusing.

Perhaps a property could be introduced to customize the encoding of the path 
parameters similar to the "search.decode.values" property that is available for 
FIQL queries (CXF-6002).

I adapted the attached zip to contain both service and client implementation.

> Path parameters containing semicolon are truncated due to missing encoding
> --------------------------------------------------------------------------
>
>                 Key: CXF-6015
>                 URL: https://issues.apache.org/jira/browse/CXF-6015
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.12, 3.0.1
>         Environment: Apache Tomcat / 7.0.54
> Eclipse Jetty / 9.2.2
>            Reporter: Daniel
>         Attachments: cxf-test.zip
>
>
> If a REST service uses path parameters, these parameters must not contain any 
> semicolon as the parameter value gets truncated after the semicolon by many 
> runtime environments. For that reason especially the semicolon should be 
> encoded while building the client proxy.
> I pinned this issue down to the usage of 
> {{org.apache.cxf.jaxrs.utils.HttpUtils.pathEncode(String)}} during the 
> creation of the request URI. Path parameters are encoded using a fixed list 
> of characters ({{=@/:!$&\'(),;~}}) that are preserved in 
> {{pathEncode(String)}}. While this is fine/needed for encoding a complete 
> path it leads to problems if used for encoding single elements of a path like 
> path parameters.
> Attached you'll find a minimal example project containing a simple REST 
> service that returns the provided path parameters. If deployed on 
> localhost:8080, a call to 
> {{http://localhost:8080/cxf-test-service-0.1/cxf-test/Rüdiger/R&uuml%3Bdiger}}
>  will result in {{anAttribute=R&uuml, anotherAttribute=Rüdiger}} to 
> be returned.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to