cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Commented] (CXF-6015) Path parameters containing semicolon are truncated due to missing encoding
Date Fri, 19 Sep 2014 14:20:36 GMT


Sergey Beryozkin commented on CXF-6015:

Client proxy converts the parameters works according to JAX-RS rules. It has no idea what
the developer's expectations are. There could be a 'conflict' but the JAX-RS rules win when
the ambiguity occurs - there's no guarantee a client proxy will competely abstract the developer
from the JAX-RS/HTTP realties.
Besides the proxy has no idea how the target server is impemented. It may not even be a JAX-RS
server. And if it is a JAX-RS server then given the method signature in your example, a custom
service may have UriInfo injected and use it to check PathSegments and get to matrix parameters.

Tomcat can be configured to keep ';', without it it would have services explicitly working
with Matrix parameters broken.

> Path parameters containing semicolon are truncated due to missing encoding
> --------------------------------------------------------------------------
>                 Key: CXF-6015
>                 URL:
>             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:
> 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&uuml;diger/R&uuml%3Bdiger}}
will result in {{anAttribute=R&uuml, anotherAttribute=R&amp;uuml;diger}} to be returned.

This message was sent by Atlassian JIRA

View raw message