You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2016/10/25 10:49:37 UTC

Re: Matrix parameter flags as per Web Application Description Language specification?

Hi

I think it is an optimization as opposed to some 'must' rule governing 
the way all the boolean matrix properties are represented.

I agree having something like "/somepath;enabled"

looks better than

"/somepath;enabled=true"

and

"/somepath;enabled=false"

is more verbose than

"/somepath"

but the more verbose options are perfectly valid URIs and note some 
services may be written to assume the parameter is included - WADL also 
has a 'required' property which can be set to true.

I can only imagine this optimization be optionally implemented at the 
client side if a property is set. Is it really important to you ?

Sergey

On 24/10/16 15:10, Christian Balzer wrote:
> Hi all,
>
> The Web Application Description Language specification [1] defines:
>
>>> Boolean matrix parameters are represented as: ';name' when 'value' is 'true' and are omitted from identifier when 'value' is 'false'
>
> Is there a way to achieve this behavior with cxf out of the box?
>
> Brgrds,
>
> Christian
> 1) https://www.w3.org/Submission/wadl/#x3-130002.6.1
>


Re: Matrix parameter flags as per Web Application Description Language specification?

Posted by Sergey Beryozkin <sb...@gmail.com>.
What I'm not sure about right now if what happens if
you have a boolean MatrixParam on the server method, and the URI 
contains "/a;b"

most likely the conversion of "" to boolean will fail, so this is where 
ParamConverter will help.

So I'd say the only issue is how to tell the proxy client that if it is 
a boolean optional property then do optimize - most likely it will 
require a property...

Cheers, Sergey

On 25/10/16 22:49, Sergey Beryozkin wrote:
> Hi Christian
>
> JAX-RS UriBuilder will produce something like "/a;b" if one only
> supplies a matrix param name, ex,
> builder.path("a").matrixParam("b");
>
> Higher level API such as JAX-RS WebTarget or CXF WebClient have
> matrixParam methods which are mapped to UriBuilder.matrixParam.
>
> So rather than deal with 'booleans' you can simply do
>
> webClient.path("a").matrixParam("enabled")
>
> ("/a;enabled")
>
> or
>
> webClient.path("a").matrixParam("disabled")
>
> ("/a;disabled")
>
> or not setting a matrix property at all,
>
> as opposed to dealing with 'enabled' true/false values.
>
> Or do you use a proxy where you have a method accepting 'boolean'
> (matrix) parameter ?
>
> Cheers, Sergey
>
> On 25/10/16 17:45, Christian Balzer wrote:
>> Hi Sergey,
>>
>> I agree this is a should, not a must - but I do like URLs to look
>> pretty... ;-)
>> I have currently no requirement for this, though - I just wanted to
>> know if it can be done with cxf.
>> I take it the answer is "no", then? :-)
>>
>> Brgrds,
>> Christian
>>
>> On Tue, Oct 25, 2016 at 11:49 AM, Sergey Beryozkin
>> <sb...@gmail.com> wrote:
>>> Hi
>>>
>>> I think it is an optimization as opposed to some 'must' rule
>>> governing the
>>> way all the boolean matrix properties are represented.
>>>
>>> I agree having something like "/somepath;enabled"
>>>
>>> looks better than
>>>
>>> "/somepath;enabled=true"
>>>
>>> and
>>>
>>> "/somepath;enabled=false"
>>>
>>> is more verbose than
>>>
>>> "/somepath"
>>>
>>> but the more verbose options are perfectly valid URIs and note some
>>> services
>>> may be written to assume the parameter is included - WADL also has a
>>> 'required' property which can be set to true.
>>>
>>> I can only imagine this optimization be optionally implemented at the
>>> client
>>> side if a property is set. Is it really important to you ?
>>>
>>> Sergey
>>>
>>>
>>> On 24/10/16 15:10, Christian Balzer wrote:
>>>>
>>>> Hi all,
>>>>
>>>> The Web Application Description Language specification [1] defines:
>>>>
>>>>>> Boolean matrix parameters are represented as: ';name' when 'value' is
>>>>>> 'true' and are omitted from identifier when 'value' is 'false'
>>>>
>>>>
>>>> Is there a way to achieve this behavior with cxf out of the box?
>>>>
>>>> Brgrds,
>>>>
>>>> Christian
>>>> 1) https://www.w3.org/Submission/wadl/#x3-130002.6.1
>>>>
>>>
>


-- 
Sergey Beryozkin

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

Re: Matrix parameter flags as per Web Application Description Language specification?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Christian

JAX-RS UriBuilder will produce something like "/a;b" if one only 
supplies a matrix param name, ex,
builder.path("a").matrixParam("b");

Higher level API such as JAX-RS WebTarget or CXF WebClient have 
matrixParam methods which are mapped to UriBuilder.matrixParam.

So rather than deal with 'booleans' you can simply do

webClient.path("a").matrixParam("enabled")

("/a;enabled")

or

webClient.path("a").matrixParam("disabled")

("/a;disabled")

or not setting a matrix property at all,

as opposed to dealing with 'enabled' true/false values.

Or do you use a proxy where you have a method accepting 'boolean' 
(matrix) parameter ?

Cheers, Sergey

On 25/10/16 17:45, Christian Balzer wrote:
> Hi Sergey,
>
> I agree this is a should, not a must - but I do like URLs to look pretty... ;-)
> I have currently no requirement for this, though - I just wanted to
> know if it can be done with cxf.
> I take it the answer is "no", then? :-)
>
> Brgrds,
> Christian
>
> On Tue, Oct 25, 2016 at 11:49 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> Hi
>>
>> I think it is an optimization as opposed to some 'must' rule governing the
>> way all the boolean matrix properties are represented.
>>
>> I agree having something like "/somepath;enabled"
>>
>> looks better than
>>
>> "/somepath;enabled=true"
>>
>> and
>>
>> "/somepath;enabled=false"
>>
>> is more verbose than
>>
>> "/somepath"
>>
>> but the more verbose options are perfectly valid URIs and note some services
>> may be written to assume the parameter is included - WADL also has a
>> 'required' property which can be set to true.
>>
>> I can only imagine this optimization be optionally implemented at the client
>> side if a property is set. Is it really important to you ?
>>
>> Sergey
>>
>>
>> On 24/10/16 15:10, Christian Balzer wrote:
>>>
>>> Hi all,
>>>
>>> The Web Application Description Language specification [1] defines:
>>>
>>>>> Boolean matrix parameters are represented as: ';name' when 'value' is
>>>>> 'true' and are omitted from identifier when 'value' is 'false'
>>>
>>>
>>> Is there a way to achieve this behavior with cxf out of the box?
>>>
>>> Brgrds,
>>>
>>> Christian
>>> 1) https://www.w3.org/Submission/wadl/#x3-130002.6.1
>>>
>>


Re: Matrix parameter flags as per Web Application Description Language specification?

Posted by Christian Balzer <ch...@gmail.com>.
Hi Sergey,

I agree this is a should, not a must - but I do like URLs to look pretty... ;-)
I have currently no requirement for this, though - I just wanted to
know if it can be done with cxf.
I take it the answer is "no", then? :-)

Brgrds,
Christian

On Tue, Oct 25, 2016 at 11:49 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi
>
> I think it is an optimization as opposed to some 'must' rule governing the
> way all the boolean matrix properties are represented.
>
> I agree having something like "/somepath;enabled"
>
> looks better than
>
> "/somepath;enabled=true"
>
> and
>
> "/somepath;enabled=false"
>
> is more verbose than
>
> "/somepath"
>
> but the more verbose options are perfectly valid URIs and note some services
> may be written to assume the parameter is included - WADL also has a
> 'required' property which can be set to true.
>
> I can only imagine this optimization be optionally implemented at the client
> side if a property is set. Is it really important to you ?
>
> Sergey
>
>
> On 24/10/16 15:10, Christian Balzer wrote:
>>
>> Hi all,
>>
>> The Web Application Description Language specification [1] defines:
>>
>>>> Boolean matrix parameters are represented as: ';name' when 'value' is
>>>> 'true' and are omitted from identifier when 'value' is 'false'
>>
>>
>> Is there a way to achieve this behavior with cxf out of the box?
>>
>> Brgrds,
>>
>> Christian
>> 1) https://www.w3.org/Submission/wadl/#x3-130002.6.1
>>
>