You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nicolas Lenoire <ni...@semarchy.com> on 2016/05/10 14:21:45 UTC

URI template resolution issue for query params

Hello,

Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10

I'm trying to resolve query params of a templated URI. However, I'm 
unable to achive this using the following approachs:

1)
String uri = UriBuilder.fromPath("my/path").queryParam("qp", 
"{param}").resolveTemplate("param", "value").toTemplate();

=> The uri string is equal to "my/path?qp={param}" whereas it should be 
"my/path?qp=value"

2)
String uri = 
UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param", 
"value").toTemplate();

=> The uri string is equal to "my/path%3Fqp=value" whereas it should be 
"my/path?qp=value"


Regards,
- NL



Re: URI template resolution issue for query params

Posted by Sergey Beryozkin <sb...@gmail.com>.
Np, I got it fixed, see

https://issues.apache.org/jira/browse/CXF-6906

thanks for the tests,

Cheers, Sergey
On 17/05/16 08:46, Nicolas Lenoire wrote:
> Sergey,
>
> No, I don't know how Jersey behaves with the 2).
>
> Regards,
> - NL
>
> On 5/16/2016 18:39, Sergey Beryozkin wrote:
>> On 16/05/16 13:11, Sergey Beryozkin wrote:
>>> Hi
>>> On 12/05/16 06:12, Sergey Beryozkin wrote:
>>>> Hi
>>>> On 10/05/16 15:21, Nicolas Lenoire wrote:
>>>>> Hello,
>>>>>
>>>>> Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10
>>>>>
>>>>> I'm trying to resolve query params of a templated URI. However, I'm
>>>>> unable to achive this using the following approachs:
>>>>>
>>>>> 1)
>>>>> String uri = UriBuilder.fromPath("my/path").queryParam("qp",
>>>>> "{param}").resolveTemplate("param", "value").toTemplate();
>>>>>
>>>>> => The uri string is equal to "my/path?qp={param}" whereas it
>>>>> should be
>>>>> "my/path?qp=value"
>>>>>
>>>> Sure, we'll have a look.
>>>
>>> This has been fixed, see
>>> https://issues.apache.org/jira/browse/CXF-6901
>>>
>>>>> 2)
>>>>> String uri =
>>>>> UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param",
>>>>> "value").toTemplate();
>>>>>
>>>>> => The uri string is equal to "my/path%3Fqp=value" whereas it
>>>>> should be
>>>>> "my/path?qp=value"
>>>> I'm not sure about this one, i.e, given a relative URI, should '?' be
>>>> interpreted as a query component separator ? Not sure yet...
>>>>
>>> I'm still not sure a relative
>>>
>>> "my/path?qp={param}" should be treated as an expression that may contain
>>> query components, I'll need to investigate. Do you know ny any chance
>>> how Jersey behaves in this case ?
>>
>> Never mind, I think this should also work, will have a look a bit
>> later too
>>
>> Sergey
>>
>>>
>>> Cheers, Sergey
>>>
>>>> Cheers, Sergey
>>>>>
>>>>>
>>>>> Regards,
>>>>> - NL
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: URI template resolution issue for query params

Posted by Nicolas Lenoire <ni...@semarchy.com>.
Sergey,

No, I don't know how Jersey behaves with the 2).

Regards,
- NL

On 5/16/2016 18:39, Sergey Beryozkin wrote:
> On 16/05/16 13:11, Sergey Beryozkin wrote:
>> Hi
>> On 12/05/16 06:12, Sergey Beryozkin wrote:
>>> Hi
>>> On 10/05/16 15:21, Nicolas Lenoire wrote:
>>>> Hello,
>>>>
>>>> Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10
>>>>
>>>> I'm trying to resolve query params of a templated URI. However, I'm
>>>> unable to achive this using the following approachs:
>>>>
>>>> 1)
>>>> String uri = UriBuilder.fromPath("my/path").queryParam("qp",
>>>> "{param}").resolveTemplate("param", "value").toTemplate();
>>>>
>>>> => The uri string is equal to "my/path?qp={param}" whereas it 
>>>> should be
>>>> "my/path?qp=value"
>>>>
>>> Sure, we'll have a look.
>>
>> This has been fixed, see
>> https://issues.apache.org/jira/browse/CXF-6901
>>
>>>> 2)
>>>> String uri =
>>>> UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param",
>>>> "value").toTemplate();
>>>>
>>>> => The uri string is equal to "my/path%3Fqp=value" whereas it 
>>>> should be
>>>> "my/path?qp=value"
>>> I'm not sure about this one, i.e, given a relative URI, should '?' be
>>> interpreted as a query component separator ? Not sure yet...
>>>
>> I'm still not sure a relative
>>
>> "my/path?qp={param}" should be treated as an expression that may contain
>> query components, I'll need to investigate. Do you know ny any chance
>> how Jersey behaves in this case ?
>
> Never mind, I think this should also work, will have a look a bit 
> later too
>
> Sergey
>
>>
>> Cheers, Sergey
>>
>>> Cheers, Sergey
>>>>
>>>>
>>>> Regards,
>>>> - NL
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: URI template resolution issue for query params

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 16/05/16 13:11, Sergey Beryozkin wrote:
> Hi
> On 12/05/16 06:12, Sergey Beryozkin wrote:
>> Hi
>> On 10/05/16 15:21, Nicolas Lenoire wrote:
>>> Hello,
>>>
>>> Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10
>>>
>>> I'm trying to resolve query params of a templated URI. However, I'm
>>> unable to achive this using the following approachs:
>>>
>>> 1)
>>> String uri = UriBuilder.fromPath("my/path").queryParam("qp",
>>> "{param}").resolveTemplate("param", "value").toTemplate();
>>>
>>> => The uri string is equal to "my/path?qp={param}" whereas it should be
>>> "my/path?qp=value"
>>>
>> Sure, we'll have a look.
>
> This has been fixed, see
> https://issues.apache.org/jira/browse/CXF-6901
>
>>> 2)
>>> String uri =
>>> UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param",
>>> "value").toTemplate();
>>>
>>> => The uri string is equal to "my/path%3Fqp=value" whereas it should be
>>> "my/path?qp=value"
>> I'm not sure about this one, i.e, given a relative URI, should '?' be
>> interpreted as a query component separator ? Not sure yet...
>>
> I'm still not sure a relative
>
> "my/path?qp={param}" should be treated as an expression that may contain
> query components, I'll need to investigate. Do you know ny any chance
> how Jersey behaves in this case ?

Never mind, I think this should also work, will have a look a bit later too

Sergey

>
> Cheers, Sergey
>
>> Cheers, Sergey
>>>
>>>
>>> Regards,
>>> - NL
>>>
>>>
>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: URI template resolution issue for query params

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 12/05/16 06:12, Sergey Beryozkin wrote:
> Hi
> On 10/05/16 15:21, Nicolas Lenoire wrote:
>> Hello,
>>
>> Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10
>>
>> I'm trying to resolve query params of a templated URI. However, I'm
>> unable to achive this using the following approachs:
>>
>> 1)
>> String uri = UriBuilder.fromPath("my/path").queryParam("qp",
>> "{param}").resolveTemplate("param", "value").toTemplate();
>>
>> => The uri string is equal to "my/path?qp={param}" whereas it should be
>> "my/path?qp=value"
>>
> Sure, we'll have a look.

This has been fixed, see
https://issues.apache.org/jira/browse/CXF-6901

>> 2)
>> String uri =
>> UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param",
>> "value").toTemplate();
>>
>> => The uri string is equal to "my/path%3Fqp=value" whereas it should be
>> "my/path?qp=value"
> I'm not sure about this one, i.e, given a relative URI, should '?' be
> interpreted as a query component separator ? Not sure yet...
>
I'm still not sure a relative

"my/path?qp={param}" should be treated as an expression that may contain 
query components, I'll need to investigate. Do you know ny any chance 
how Jersey behaves in this case ?

Cheers, Sergey

> Cheers, Sergey
>>
>>
>> Regards,
>> - NL
>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: URI template resolution issue for query params

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 10/05/16 15:21, Nicolas Lenoire wrote:
> Hello,
>
> Environment: CXF (JAXRS) 3.1.5 / JDK 1.7 / Windows 10
>
> I'm trying to resolve query params of a templated URI. However, I'm
> unable to achive this using the following approachs:
>
> 1)
> String uri = UriBuilder.fromPath("my/path").queryParam("qp",
> "{param}").resolveTemplate("param", "value").toTemplate();
>
> => The uri string is equal to "my/path?qp={param}" whereas it should be
> "my/path?qp=value"
>
Sure, we'll have a look.
> 2)
> String uri =
> UriBuilder.fromUri("my/path?qp={param}").resolveTemplate("param",
> "value").toTemplate();
>
> => The uri string is equal to "my/path%3Fqp=value" whereas it should be
> "my/path?qp=value"
I'm not sure about this one, i.e, given a relative URI, should '?' be 
interpreted as a query component separator ? Not sure yet...

Cheers, Sergey
>
>
> Regards,
> - NL
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/