users@jersey.java.net

Re: wild cards in _at_UriTemplate

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 17 Oct 2007 14:22:28 -0700

On Oct 17, 2007, at 12:32 PM, A S Manzoor wrote:
>
> Is there any way to get UriTemplate to match wild cards? In a nut
> shell, the number of segments in a uri is indeterminate (I am not
> talking about the terminal segment which can be handled using
> limited=false). For instance, @UriTemplate(value="{name}/
> {workspace}/{folders}/edit"). Here the {folders} may have one or
> more segments. It would then be really nice to have @UriParam
> ("folders") String[] folders. One could then argue for generalizing
> this by supporting regular expressions, though I have no current
> use cases to require support for that. I am pretty sure UriTemplate
> & UriParam doesn't offer this. If not, does something like this
> make sense? Could it possibly be supported at some point?
>
Rather than use a final path segment for "edit", perhaps you could
use a matrix param instead? Then you could use the limited=false
mechanism to get the value of {folders} since matrix params are not
by default considered significant for URI template matching.

We don't support automatically splitting the resulting string but you
could instead use your own type instead of String[] with a
constructor that takes a String to do that.

Hope that helps,
Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.