cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy McCright <j.andrew.mccri...@gmail.com>
Subject Re: JAX-RS Client preserve empty slashes
Date Tue, 13 Jun 2017 14:07:25 GMT
HI Sergey,

Thanks for the response.  I ran the same code using the JAX-RS 2.0 RI
(Jersey 2.25.1) and it preserved the double-slash.  CXF removes it.

I'm not convinced that CXF is in violation of the spec (I suspect there are
more than a few differences between JAX-RS implementations that still meet
the letter and spirit of the spec), but I'm just wondering if there is an
easy way to allow this customer to get the desired behavior with CXF -
possibly by adding a client property.

Thanks again,

Andy

On Tue, Jun 13, 2017 at 7:49 AM, Sergey Beryozkin <sberyozkin@gmail.com>
wrote:

> Hi Andy
>
> It is most likely caused by UriBuilder parsing the URI and then dropping
> the empty path segments.
>
> As far as I recall UriBuilder.path() must guarantee that if we have say
>
> .path("a/").path("/b") then the builder should ensure no duplicate "//"
> appear in the final URI.
>
> However I'm not sure what the expectations are if the "//" was in the
> initial URI value, whether it should be preserved or not.
>
> Do you know by any chance what RI does in this case, at the UriBuilder
> level ?
>
> Thanks, Sergey
>
>
> On 05/06/17 15:29, Andy McCright wrote:
>
>> Hi All,
>>
>> One of our customers hit an issue where they cannot preserve an empty
>> slash
>> in an outbound request.
>>
>> For example, they code up:
>>
>> WebTarget target = ClientBuilder.newClient().target("
>> http://example.com/api//something");
>> System.out.println(target.getUri());
>>
>> but the resulting URI is:  "http://example.com/api/something" without the
>> extra slash between api and something.
>>
>> Is there any way to prevent the normalization that removes the extra
>> slash?
>>
>> The original customer post is here:
>> https://developer.ibm.com/answers/questions/378780/how-can-
>> i-create-a-webtarget-with-double-in-path.html
>>
>> The customer did not say, but I believe they may be using a WebSphere
>> Liberty version that ships with CXF 3.1.8.
>>
>> Thanks in advance,
>>
>> Andy
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message