You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Gerolf Seitz <ge...@gmail.com> on 2008/02/08 11:42:46 UTC
wildcard support for mount paths
hi all,
i was wondering whether it's possible to have wildcards in mountpaths.
this would give us more flexibility, as it allows page parameters to be
somehow
part of the mount path.
take for example this mount path: /blog/*/post
the * means that there needs to be exactly one parameter between the path
fragments blog and post.
after the path fragment post, there can be 0 or more parameters, as usual.
some more thoughts
# wildcards only make sense when a page is mounted with
Indexed*UrlCodingStrategy,
as the parameters are ordered (0,1,2,...) with these strategies. otherwise,
how do you decide
which parameter is used for which wildcard? and since parameters are denoted
by name, the order
doesn't matter, also not where in the path the parameter is located (but
typically it will be after the mount path)
# the parameter ordering is the same as we have it now, regardless where the
parameter is located.
mountpath: /blog/*/post
path for a request: /blog/gseitz/post/2008/
"gseitz" ... 0th param
"2008" ... 1st param
# there must be at least one "fixed" mount path fragment (again, same as we
have it now),
but it doesn't matter _where_ the fragment is positioned in the mount path.
so it's possible to mount a page like this: /*/profile
mountpaths like /* or /*/* etc. are not allowed (at least not for
urlstrategies that support wildcards
via an interface like IWildcardProcessingUrlCodingStrategy)
# in case the actual parameter for the wildcard parameter is omitted, the
request isn't even
handed over to the specific urlcodingstrategy
i have a working implementation for the above mentioned use cases, but i
certainly wanted to get
some opinions whether we want to integrate this. so i appreciate any
feedback.
cheers,
Gerolf
Re: wildcard support for mount paths
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
true.. Better to solve 90 percent (maybe more), and have a simple
understandable solution..
Johan Compagner wrote:
> This is really overly complex...
> Keep it simple, ask do you really need such a thing...
>
> On 2/8/08, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
>
>> Yeah I guess that depends if wildcard only goes one layer deep..?
>>
>> That way you could do this:
>>
>> /*/foo
>> /blog/*/post
>> /blog/foo/*
>> /blog/foo/post/*
>>
>> etc..
>>
>> That for instance mean that /blog/foo/post/bar/snafu wouldnt be
>> catched.. We could then have a all match
>>
>> /blog/foo*
>>
>> which would match all lower levels.. But I think this is one to watch
>> out for, as having two filters match would give trouble..
>>
>> Igor Vaynberg wrote:
>>
>>> what happens if i have mounts
>>>
>>> /blog/*/post
>>> /blog/foo/post/bar
>>>
>>> which one is matched? do we not allow this to happen? i would really
>>> hate to see a situation where the order of calls to mount plays into
>>> resolution...
>>>
>>> -igor
>>>
>>>
>>> On Feb 8, 2008 2:42 AM, Gerolf Seitz <ge...@gmail.com> wrote:
>>>
>>>
>>>> hi all,
>>>>
>>>> i was wondering whether it's possible to have wildcards in mountpaths.
>>>> this would give us more flexibility, as it allows page parameters to be
>>>> somehow
>>>> part of the mount path.
>>>>
>>>> take for example this mount path: /blog/*/post
>>>> the * means that there needs to be exactly one parameter between the path
>>>> fragments blog and post.
>>>> after the path fragment post, there can be 0 or more parameters, as
>>>>
>> usual.
>>
>>>> some more thoughts
>>>>
>>>> # wildcards only make sense when a page is mounted with
>>>> Indexed*UrlCodingStrategy,
>>>> as the parameters are ordered (0,1,2,...) with these strategies.
>>>>
>> otherwise,
>>
>>>> how do you decide
>>>> which parameter is used for which wildcard? and since parameters are
>>>>
>> denoted
>>
>>>> by name, the order
>>>> doesn't matter, also not where in the path the parameter is located (but
>>>> typically it will be after the mount path)
>>>>
>>>> # the parameter ordering is the same as we have it now, regardless where
>>>>
>> the
>>
>>>> parameter is located.
>>>> mountpath: /blog/*/post
>>>> path for a request: /blog/gseitz/post/2008/
>>>> "gseitz" ... 0th param
>>>> "2008" ... 1st param
>>>>
>>>> # there must be at least one "fixed" mount path fragment (again, same as
>>>>
>> we
>>
>>>> have it now),
>>>> but it doesn't matter _where_ the fragment is positioned in the mount
>>>>
>> path.
>>
>>>> so it's possible to mount a page like this: /*/profile
>>>> mountpaths like /* or /*/* etc. are not allowed (at least not for
>>>> urlstrategies that support wildcards
>>>> via an interface like IWildcardProcessingUrlCodingStrategy)
>>>>
>>>> # in case the actual parameter for the wildcard parameter is omitted, the
>>>> request isn't even
>>>> handed over to the specific urlcodingstrategy
>>>>
>>>>
>>>> i have a working implementation for the above mentioned use cases, but i
>>>> certainly wanted to get
>>>> some opinions whether we want to integrate this. so i appreciate any
>>>> feedback.
>>>>
>>>> cheers,
>>>> Gerolf
>>>>
>>>>
>>>>
>>>
>>>
>> --
>> Nino Martinez Wael
>> Java Specialist @ Jayway DK
>> http://www.jayway.dk
>> +45 2936 7684
>>
>>
>>
>
>
>
--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
Re: wildcard support for mount paths
Posted by Johan Compagner <jc...@gmail.com>.
This is really overly complex...
Keep it simple, ask do you really need such a thing...
On 2/8/08, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
> Yeah I guess that depends if wildcard only goes one layer deep..?
>
> That way you could do this:
>
> /*/foo
> /blog/*/post
> /blog/foo/*
> /blog/foo/post/*
>
> etc..
>
> That for instance mean that /blog/foo/post/bar/snafu wouldnt be
> catched.. We could then have a all match
>
> /blog/foo*
>
> which would match all lower levels.. But I think this is one to watch
> out for, as having two filters match would give trouble..
>
> Igor Vaynberg wrote:
> > what happens if i have mounts
> >
> > /blog/*/post
> > /blog/foo/post/bar
> >
> > which one is matched? do we not allow this to happen? i would really
> > hate to see a situation where the order of calls to mount plays into
> > resolution...
> >
> > -igor
> >
> >
> > On Feb 8, 2008 2:42 AM, Gerolf Seitz <ge...@gmail.com> wrote:
> >
> >> hi all,
> >>
> >> i was wondering whether it's possible to have wildcards in mountpaths.
> >> this would give us more flexibility, as it allows page parameters to be
> >> somehow
> >> part of the mount path.
> >>
> >> take for example this mount path: /blog/*/post
> >> the * means that there needs to be exactly one parameter between the path
> >> fragments blog and post.
> >> after the path fragment post, there can be 0 or more parameters, as
> usual.
> >>
> >> some more thoughts
> >>
> >> # wildcards only make sense when a page is mounted with
> >> Indexed*UrlCodingStrategy,
> >> as the parameters are ordered (0,1,2,...) with these strategies.
> otherwise,
> >> how do you decide
> >> which parameter is used for which wildcard? and since parameters are
> denoted
> >> by name, the order
> >> doesn't matter, also not where in the path the parameter is located (but
> >> typically it will be after the mount path)
> >>
> >> # the parameter ordering is the same as we have it now, regardless where
> the
> >> parameter is located.
> >> mountpath: /blog/*/post
> >> path for a request: /blog/gseitz/post/2008/
> >> "gseitz" ... 0th param
> >> "2008" ... 1st param
> >>
> >> # there must be at least one "fixed" mount path fragment (again, same as
> we
> >> have it now),
> >> but it doesn't matter _where_ the fragment is positioned in the mount
> path.
> >> so it's possible to mount a page like this: /*/profile
> >> mountpaths like /* or /*/* etc. are not allowed (at least not for
> >> urlstrategies that support wildcards
> >> via an interface like IWildcardProcessingUrlCodingStrategy)
> >>
> >> # in case the actual parameter for the wildcard parameter is omitted, the
> >> request isn't even
> >> handed over to the specific urlcodingstrategy
> >>
> >>
> >> i have a working implementation for the above mentioned use cases, but i
> >> certainly wanted to get
> >> some opinions whether we want to integrate this. so i appreciate any
> >> feedback.
> >>
> >> cheers,
> >> Gerolf
> >>
> >>
> >
> >
> >
>
> --
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
Re: wildcard support for mount paths
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Yeah I guess that depends if wildcard only goes one layer deep..?
That way you could do this:
/*/foo
/blog/*/post
/blog/foo/*
/blog/foo/post/*
etc..
That for instance mean that /blog/foo/post/bar/snafu wouldnt be
catched.. We could then have a all match
/blog/foo*
which would match all lower levels.. But I think this is one to watch
out for, as having two filters match would give trouble..
Igor Vaynberg wrote:
> what happens if i have mounts
>
> /blog/*/post
> /blog/foo/post/bar
>
> which one is matched? do we not allow this to happen? i would really
> hate to see a situation where the order of calls to mount plays into
> resolution...
>
> -igor
>
>
> On Feb 8, 2008 2:42 AM, Gerolf Seitz <ge...@gmail.com> wrote:
>
>> hi all,
>>
>> i was wondering whether it's possible to have wildcards in mountpaths.
>> this would give us more flexibility, as it allows page parameters to be
>> somehow
>> part of the mount path.
>>
>> take for example this mount path: /blog/*/post
>> the * means that there needs to be exactly one parameter between the path
>> fragments blog and post.
>> after the path fragment post, there can be 0 or more parameters, as usual.
>>
>> some more thoughts
>>
>> # wildcards only make sense when a page is mounted with
>> Indexed*UrlCodingStrategy,
>> as the parameters are ordered (0,1,2,...) with these strategies. otherwise,
>> how do you decide
>> which parameter is used for which wildcard? and since parameters are denoted
>> by name, the order
>> doesn't matter, also not where in the path the parameter is located (but
>> typically it will be after the mount path)
>>
>> # the parameter ordering is the same as we have it now, regardless where the
>> parameter is located.
>> mountpath: /blog/*/post
>> path for a request: /blog/gseitz/post/2008/
>> "gseitz" ... 0th param
>> "2008" ... 1st param
>>
>> # there must be at least one "fixed" mount path fragment (again, same as we
>> have it now),
>> but it doesn't matter _where_ the fragment is positioned in the mount path.
>> so it's possible to mount a page like this: /*/profile
>> mountpaths like /* or /*/* etc. are not allowed (at least not for
>> urlstrategies that support wildcards
>> via an interface like IWildcardProcessingUrlCodingStrategy)
>>
>> # in case the actual parameter for the wildcard parameter is omitted, the
>> request isn't even
>> handed over to the specific urlcodingstrategy
>>
>>
>> i have a working implementation for the above mentioned use cases, but i
>> certainly wanted to get
>> some opinions whether we want to integrate this. so i appreciate any
>> feedback.
>>
>> cheers,
>> Gerolf
>>
>>
>
>
>
--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
Re: wildcard support for mount paths
Posted by Gerolf Seitz <ge...@gmail.com>.
right, the order of the mount calls should never be important.
and in fact, it isn't. the mount paths are stored in a TreeMap wich
sorts the mount paths lexically and by length.
this yields the following order in checking mount points for resolving the
request target:
foo/baz
foo/bar
foo/*/bar
foo
bar
now let's assume foo/baz is mounted with mountBookmarkablePage(..) and the
path for the request is foo/baz/bar and you originally wanted the request to
target the
mount point foo/*/bar.
as of now, this doesn't work. the first (relevant) mount point that will be
checked
is foo/baz, _but_ an exception will be thrown, because of an unmatched
key/value pair: bar
now the question arises: should an IRequestTargetUrlCodingStrategy return
true in the matches method,
even if it knows that it can't handle the request?
gerolf
On Feb 8, 2008 7:57 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> what happens if i have mounts
>
> /blog/*/post
> /blog/foo/post/bar
>
> which one is matched? do we not allow this to happen? i would really
> hate to see a situation where the order of calls to mount plays into
> resolution...
>
> -igor
>
>
> On Feb 8, 2008 2:42 AM, Gerolf Seitz <ge...@gmail.com> wrote:
> > hi all,
> >
> > i was wondering whether it's possible to have wildcards in mountpaths.
> > this would give us more flexibility, as it allows page parameters to be
> > somehow
> > part of the mount path.
> >
> > take for example this mount path: /blog/*/post
> > the * means that there needs to be exactly one parameter between the
> path
> > fragments blog and post.
> > after the path fragment post, there can be 0 or more parameters, as
> usual.
> >
> > some more thoughts
> >
> > # wildcards only make sense when a page is mounted with
> > Indexed*UrlCodingStrategy,
> > as the parameters are ordered (0,1,2,...) with these strategies.
> otherwise,
> > how do you decide
> > which parameter is used for which wildcard? and since parameters are
> denoted
> > by name, the order
> > doesn't matter, also not where in the path the parameter is located (but
> > typically it will be after the mount path)
> >
> > # the parameter ordering is the same as we have it now, regardless where
> the
> > parameter is located.
> > mountpath: /blog/*/post
> > path for a request: /blog/gseitz/post/2008/
> > "gseitz" ... 0th param
> > "2008" ... 1st param
> >
> > # there must be at least one "fixed" mount path fragment (again, same as
> we
> > have it now),
> > but it doesn't matter _where_ the fragment is positioned in the mount
> path.
> > so it's possible to mount a page like this: /*/profile
> > mountpaths like /* or /*/* etc. are not allowed (at least not for
> > urlstrategies that support wildcards
> > via an interface like IWildcardProcessingUrlCodingStrategy)
> >
> > # in case the actual parameter for the wildcard parameter is omitted,
> the
> > request isn't even
> > handed over to the specific urlcodingstrategy
> >
> >
> > i have a working implementation for the above mentioned use cases, but i
> > certainly wanted to get
> > some opinions whether we want to integrate this. so i appreciate any
> > feedback.
> >
> > cheers,
> > Gerolf
> >
>
Re: wildcard support for mount paths
Posted by Igor Vaynberg <ig...@gmail.com>.
what happens if i have mounts
/blog/*/post
/blog/foo/post/bar
which one is matched? do we not allow this to happen? i would really
hate to see a situation where the order of calls to mount plays into
resolution...
-igor
On Feb 8, 2008 2:42 AM, Gerolf Seitz <ge...@gmail.com> wrote:
> hi all,
>
> i was wondering whether it's possible to have wildcards in mountpaths.
> this would give us more flexibility, as it allows page parameters to be
> somehow
> part of the mount path.
>
> take for example this mount path: /blog/*/post
> the * means that there needs to be exactly one parameter between the path
> fragments blog and post.
> after the path fragment post, there can be 0 or more parameters, as usual.
>
> some more thoughts
>
> # wildcards only make sense when a page is mounted with
> Indexed*UrlCodingStrategy,
> as the parameters are ordered (0,1,2,...) with these strategies. otherwise,
> how do you decide
> which parameter is used for which wildcard? and since parameters are denoted
> by name, the order
> doesn't matter, also not where in the path the parameter is located (but
> typically it will be after the mount path)
>
> # the parameter ordering is the same as we have it now, regardless where the
> parameter is located.
> mountpath: /blog/*/post
> path for a request: /blog/gseitz/post/2008/
> "gseitz" ... 0th param
> "2008" ... 1st param
>
> # there must be at least one "fixed" mount path fragment (again, same as we
> have it now),
> but it doesn't matter _where_ the fragment is positioned in the mount path.
> so it's possible to mount a page like this: /*/profile
> mountpaths like /* or /*/* etc. are not allowed (at least not for
> urlstrategies that support wildcards
> via an interface like IWildcardProcessingUrlCodingStrategy)
>
> # in case the actual parameter for the wildcard parameter is omitted, the
> request isn't even
> handed over to the specific urlcodingstrategy
>
>
> i have a working implementation for the above mentioned use cases, but i
> certainly wanted to get
> some opinions whether we want to integrate this. so i appreciate any
> feedback.
>
> cheers,
> Gerolf
>
Re: wildcard support for mount paths
Posted by Johan Compagner <jc...@gmail.com>.
Ok this is more that you predefine where what should go. That looks
like a nice coding strategy on itself that on decode time it maps the
first param value to userid param and the second (profile) is used to
get to the right mount class. At encode time it expects to find a
userid param and adds the mount param also
On 2/8/08, John Krasnay <jo...@krasnay.ca> wrote:
> On Fri, Feb 08, 2008 at 11:42:46AM +0100, Gerolf Seitz wrote:
> >
> > i have a working implementation for the above mentioned use cases, but i
> > certainly wanted to get
> > some opinions whether we want to integrate this. so i appreciate any
> > feedback.
> >
> > cheers,
> > Gerolf
>
> I think this would be really cool.
>
> One variation on this theme would be to give the parameters names a la
> URI Templates (http://bitworking.org/projects/URI-Templates/). For
> example:
>
> /user/{userId}/profile
>
> ...would result in a page with the page parameter userId set to whatever
> was matched by {userId}. I think RoR uses something like this.
>
> jk
>
Re: wildcard support for mount paths
Posted by Gerolf Seitz <ge...@gmail.com>.
> One variation on this theme would be to give the parameters names a la
> URI Templates (http://bitworking.org/projects/URI-Templates/). For
> example:
>
> /user/{userId}/profile
>
> ...would result in a page with the page parameter userId set to whatever
> was matched by {userId}. I think RoR uses something like this.
>
good idea,
this way it would even make sense for non Indexed*UrlCodingStrategies
gerolf
Re: wildcard support for mount paths
Posted by John Krasnay <jo...@krasnay.ca>.
On Fri, Feb 08, 2008 at 11:42:46AM +0100, Gerolf Seitz wrote:
>
> i have a working implementation for the above mentioned use cases, but i
> certainly wanted to get
> some opinions whether we want to integrate this. so i appreciate any
> feedback.
>
> cheers,
> Gerolf
I think this would be really cool.
One variation on this theme would be to give the parameters names a la
URI Templates (http://bitworking.org/projects/URI-Templates/). For
example:
/user/{userId}/profile
...would result in a page with the page parameter userId set to whatever
was matched by {userId}. I think RoR uses something like this.
jk
Re: wildcard support for mount paths
Posted by Johan Compagner <jc...@gmail.com>.
Yes this is fine, i just want to see what is easy to understand (and
implement for us and use)
I think this will not be suported:
/*/blog
Thats just horrible. Then we really have to parse every url...
What i do like is something like this:
/blog/*/xxx
and that then only means that that encoding strategy is mounted on:
/blog
that /*/xxx is then inteprted by the encoding strategy (and they can have
ofcourse more then 1)
For an indexed this means that * can have something and xxxx is added as the
last part)
for a query string it means that xxxx param must be there or something ..
this only means that the encoding strategies have to have a bit more logic
because they are not only matched
by the mount but also internally on something else.. (mounts in mounts)
johan
On Feb 9, 2008 11:32 AM, Gerolf Seitz <ge...@gmail.com> wrote:
> i agree the * symbol wasn't the best choice.
>
> the original idea for this was to avoid having users create
> dispatch pages which only check for the existence of parameters
> and then forward the request to another page, but rather mount the right
> page
> directly to the desired path.
>
> maybe there's already a better way of doing this some other way, but i
> thought it might be worth exploring whether this can be handled for users.
>
> Gerolf
>
>
> On Feb 9, 2008 9:38 AM, Johan Compagner <jc...@gmail.com> wrote:
>
> > I think this will make things more comples. And what you want is
> > easily solved by just making the 'post' url string part also an
> > parameter. You dont do anything with it but your example like
> >
> > /blog/gerolf/2008/post
> >
> > Where for you only the middle 2 are importand but the last one is just
> > discarded.
> > Or are you saying that you also want to have besides that bookmark
> > another one like /blog/*/view ? This is also already 'possible' to do
> > in wicket but thats not very nice solution, i agree.
> >
> > So if it is the case that you want to have /blog/*/view and
> > /blog/*/post then i would say that * means any param must be post..
> > Then it is very easy to implement..
> > It is just mounted under /blog but the indexed can have another hit
> > criteria and that is 1 of its params must be view. If we add the
> > second 'post' then it is still under the mount /blog but added to the
> > other one that now also checks for post param.
> > Then we loose thism, this /blog/*/*/post is the same as /blog/*/post
> > but if that really matters...
> >
> > By the way * mostly already means 1 or more. Look at regexp.
> >
> > So for me its not a wildcard expression but a mount path to tell that
> > there must be a param in it. Then we also can use it for all other
> > coding strategies.
> >
> >
> >
> > On 2/8/08, Gerolf Seitz <ge...@gmail.com> wrote:
> > > hi all,
> > >
> > > i was wondering whether it's possible to have wildcards in mountpaths.
> > > this would give us more flexibility, as it allows page parameters to
> be
> > > somehow
> > > part of the mount path.
> > >
> > > take for example this mount path: /blog/*/post
> > > the * means that there needs to be exactly one parameter between the
> > path
> > > fragments blog and post.
> > > after the path fragment post, there can be 0 or more parameters, as
> > usual.
> > >
> > > some more thoughts
> > >
> > > # wildcards only make sense when a page is mounted with
> > > Indexed*UrlCodingStrategy,
> > > as the parameters are ordered (0,1,2,...) with these strategies.
> > otherwise,
> > > how do you decide
> > > which parameter is used for which wildcard? and since parameters are
> > denoted
> > > by name, the order
> > > doesn't matter, also not where in the path the parameter is located
> (but
> > > typically it will be after the mount path)
> > >
> > > # the parameter ordering is the same as we have it now, regardless
> where
> > the
> > > parameter is located.
> > > mountpath: /blog/*/post
> > > path for a request: /blog/gseitz/post/2008/
> > > "gseitz" ... 0th param
> > > "2008" ... 1st param
> > >
> > > # there must be at least one "fixed" mount path fragment (again, same
> as
> > we
> > > have it now),
> > > but it doesn't matter _where_ the fragment is positioned in the mount
> > path.
> > > so it's possible to mount a page like this: /*/profile
> > > mountpaths like /* or /*/* etc. are not allowed (at least not for
> > > urlstrategies that support wildcards
> > > via an interface like IWildcardProcessingUrlCodingStrategy)
> > >
> > > # in case the actual parameter for the wildcard parameter is omitted,
> > the
> > > request isn't even
> > > handed over to the specific urlcodingstrategy
> > >
> > >
> > > i have a working implementation for the above mentioned use cases, but
> i
> > > certainly wanted to get
> > > some opinions whether we want to integrate this. so i appreciate any
> > > feedback.
> > >
> > > cheers,
> > > Gerolf
> > >
> >
>
Re: wildcard support for mount paths
Posted by Gerolf Seitz <ge...@gmail.com>.
i agree the * symbol wasn't the best choice.
the original idea for this was to avoid having users create
dispatch pages which only check for the existence of parameters
and then forward the request to another page, but rather mount the right
page
directly to the desired path.
maybe there's already a better way of doing this some other way, but i
thought it might be worth exploring whether this can be handled for users.
Gerolf
On Feb 9, 2008 9:38 AM, Johan Compagner <jc...@gmail.com> wrote:
> I think this will make things more comples. And what you want is
> easily solved by just making the 'post' url string part also an
> parameter. You dont do anything with it but your example like
>
> /blog/gerolf/2008/post
>
> Where for you only the middle 2 are importand but the last one is just
> discarded.
> Or are you saying that you also want to have besides that bookmark
> another one like /blog/*/view ? This is also already 'possible' to do
> in wicket but thats not very nice solution, i agree.
>
> So if it is the case that you want to have /blog/*/view and
> /blog/*/post then i would say that * means any param must be post..
> Then it is very easy to implement..
> It is just mounted under /blog but the indexed can have another hit
> criteria and that is 1 of its params must be view. If we add the
> second 'post' then it is still under the mount /blog but added to the
> other one that now also checks for post param.
> Then we loose thism, this /blog/*/*/post is the same as /blog/*/post
> but if that really matters...
>
> By the way * mostly already means 1 or more. Look at regexp.
>
> So for me its not a wildcard expression but a mount path to tell that
> there must be a param in it. Then we also can use it for all other
> coding strategies.
>
>
>
> On 2/8/08, Gerolf Seitz <ge...@gmail.com> wrote:
> > hi all,
> >
> > i was wondering whether it's possible to have wildcards in mountpaths.
> > this would give us more flexibility, as it allows page parameters to be
> > somehow
> > part of the mount path.
> >
> > take for example this mount path: /blog/*/post
> > the * means that there needs to be exactly one parameter between the
> path
> > fragments blog and post.
> > after the path fragment post, there can be 0 or more parameters, as
> usual.
> >
> > some more thoughts
> >
> > # wildcards only make sense when a page is mounted with
> > Indexed*UrlCodingStrategy,
> > as the parameters are ordered (0,1,2,...) with these strategies.
> otherwise,
> > how do you decide
> > which parameter is used for which wildcard? and since parameters are
> denoted
> > by name, the order
> > doesn't matter, also not where in the path the parameter is located (but
> > typically it will be after the mount path)
> >
> > # the parameter ordering is the same as we have it now, regardless where
> the
> > parameter is located.
> > mountpath: /blog/*/post
> > path for a request: /blog/gseitz/post/2008/
> > "gseitz" ... 0th param
> > "2008" ... 1st param
> >
> > # there must be at least one "fixed" mount path fragment (again, same as
> we
> > have it now),
> > but it doesn't matter _where_ the fragment is positioned in the mount
> path.
> > so it's possible to mount a page like this: /*/profile
> > mountpaths like /* or /*/* etc. are not allowed (at least not for
> > urlstrategies that support wildcards
> > via an interface like IWildcardProcessingUrlCodingStrategy)
> >
> > # in case the actual parameter for the wildcard parameter is omitted,
> the
> > request isn't even
> > handed over to the specific urlcodingstrategy
> >
> >
> > i have a working implementation for the above mentioned use cases, but i
> > certainly wanted to get
> > some opinions whether we want to integrate this. so i appreciate any
> > feedback.
> >
> > cheers,
> > Gerolf
> >
>
Re: wildcard support for mount paths
Posted by Johan Compagner <jc...@gmail.com>.
I think this will make things more comples. And what you want is
easily solved by just making the 'post' url string part also an
parameter. You dont do anything with it but your example like
/blog/gerolf/2008/post
Where for you only the middle 2 are importand but the last one is just
discarded.
Or are you saying that you also want to have besides that bookmark
another one like /blog/*/view ? This is also already 'possible' to do
in wicket but thats not very nice solution, i agree.
So if it is the case that you want to have /blog/*/view and
/blog/*/post then i would say that * means any param must be post..
Then it is very easy to implement..
It is just mounted under /blog but the indexed can have another hit
criteria and that is 1 of its params must be view. If we add the
second 'post' then it is still under the mount /blog but added to the
other one that now also checks for post param.
Then we loose thism, this /blog/*/*/post is the same as /blog/*/post
but if that really matters...
By the way * mostly already means 1 or more. Look at regexp.
So for me its not a wildcard expression but a mount path to tell that
there must be a param in it. Then we also can use it for all other
coding strategies.
On 2/8/08, Gerolf Seitz <ge...@gmail.com> wrote:
> hi all,
>
> i was wondering whether it's possible to have wildcards in mountpaths.
> this would give us more flexibility, as it allows page parameters to be
> somehow
> part of the mount path.
>
> take for example this mount path: /blog/*/post
> the * means that there needs to be exactly one parameter between the path
> fragments blog and post.
> after the path fragment post, there can be 0 or more parameters, as usual.
>
> some more thoughts
>
> # wildcards only make sense when a page is mounted with
> Indexed*UrlCodingStrategy,
> as the parameters are ordered (0,1,2,...) with these strategies. otherwise,
> how do you decide
> which parameter is used for which wildcard? and since parameters are denoted
> by name, the order
> doesn't matter, also not where in the path the parameter is located (but
> typically it will be after the mount path)
>
> # the parameter ordering is the same as we have it now, regardless where the
> parameter is located.
> mountpath: /blog/*/post
> path for a request: /blog/gseitz/post/2008/
> "gseitz" ... 0th param
> "2008" ... 1st param
>
> # there must be at least one "fixed" mount path fragment (again, same as we
> have it now),
> but it doesn't matter _where_ the fragment is positioned in the mount path.
> so it's possible to mount a page like this: /*/profile
> mountpaths like /* or /*/* etc. are not allowed (at least not for
> urlstrategies that support wildcards
> via an interface like IWildcardProcessingUrlCodingStrategy)
>
> # in case the actual parameter for the wildcard parameter is omitted, the
> request isn't even
> handed over to the specific urlcodingstrategy
>
>
> i have a working implementation for the above mentioned use cases, but i
> certainly wanted to get
> some opinions whether we want to integrate this. so i appreciate any
> feedback.
>
> cheers,
> Gerolf
>