dev@jersey.java.net

Re: mapping complex database primary key to UriTemplate

From: Peter Liu <Peter.Liu_at_Sun.COM>
Date: Fri, 28 Sep 2007 12:05:18 -0700

Paul Sandoz wrote:
> Peter Liu wrote:
>> I am currently thinking about how we can support complex database
>> primary keys.
>> For example, let's say a primary key is made up of column1 and column2.
>> One possible way to map this to the UriTemplate would be
>> {column1}/{column2}.
>> However, this implies that there is a hierarchy between the columns.
>> Another way to map it would be {column1},{column2} or
>> {column1};{column2}.
>> This doesn't imply a hierarchy but I don't believe this is currently
>> supported by jersey.
>>
>> So, I have two questions. First, which mapping is preferable? If the
>> second form is preferred,
>> can this be supported in jersey?
>>
>
> The templates are quite flexible and you are not limited to one
> template per path segment. You can have a templates like the following:
>
> "{column1},{column2}"
>
> "({column1},{column2})"
>
> "[{column1}]:[{column2}]"
>
> "1={column1},2={column2}"
>
> Be careful of using the ';' because Jersey, by default, will think
> that the path segment contains zero or more matrix parameters, and
> these will be stripped from the path before matching occurs. This can
> be viewed as a bug, templates with ';' should override matrix
> parameters, but off the top of my head this might be rather tricky to
> fix (the workaround is to turn off matrix param support by setting the
> feature to false in the resource config).
>
Great! You learn something new everyday :-)
I think I'll use the comma separated list.

Thanks.

Peter

> Paul.
>
>> Thanks.
>>
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>
>