no you didn't understand it.
If you don't have exactly the same parameter in this call:
mount("/de",new IndexedParamUrlCodingStrategy("/de",Katalog.class));
So if it was this:
mount("/en",new IndexedParamUrlCodingStrategy("/de",Katalog.class));
Then it doesn't work. The request target will generate an url that will
start with "/de"
but incomming request that now have a path "/de/xxxx" don't match with the
"/en" key where the strategy is mapped on. So it does't match.
So i your case it is very strange that it works (as you say i haven't tested
it)
because you do this:
mount("/en",new IndexedParamUrlCodingStrategy("",Katalog.class));
then the coding strategy makes urls without the /en mount
like /ParamA/ParamB
then the url comes back in
but /ParamA/ParamB doesn't start with "/en" so it doesn't map on your coding
strategy.
So who is decoding it??
It just has to be in sync. So thats why i removed that param in the mount.
It doesn't make any sense that it is not in sync.
johan
On 11/15/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote:
it did. you just didnt understand it yet -
in wicket 1.x you can mount a page to
/de
/en
and not having the IndexedPar...egy putting the /de everytime in front -
but
you were responsible for that by having the 0 param beeing set to e.g: de
.
A nice URL paradigm begins by creating it on paper and by putting out
everything you dont want - and even if you prefer component or not, its a
missioncritical thing nowadays for public websites (security, spiders
etc.)
e.g: having only 1 (!) active mount in wicket 2.0 like now destroys this
completely, what in wicket 1.x worked
imagine you have a big business site, and the paradigm tells you to order
the language by var URL paradigms, whereas /en and /de are new and
reworked
by using wicket, while /cn and /ar are old ones managed by other
systems...
or a shop that has to show prices for various countries in various
languages
you need to put it anywhere to, when the page should be bookmarkable and
nice
so we have 2 paradigms:
- /page/lang/params
- /lang/params
wich one is nicer ? the second, as it allows you to be as flexible as you
want and this was what i like in wicket 1.x - you were free to do what you
want, not forced to develop your own thing if you need it...
in wicket 1.x you can just use the
mount("/de/", new IndexedParamUrlCodingStrategy("",Katalog.class));
telling him he has pages mounted unter "/de/" and they should use a
IndexedParam without any special thing to it, while in wicket 2 this has
been stripped and now forces us to have a CodingStrategy that relies on
other things
you also cant then easily upgrade older URLCodingStrategies as mount no
longer can be used to mount a path and a strategy but only the strategy
alone...
i understand most changes in wicket2, as they have more pros then cons,
but
this one has only cons as i dont see any advancement but lost
base-functionality
Regards
Korbinian
> -----Ursprüngliche Nachricht-----
> Von: Johan Compagner [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 15. November 2006 16:35
> An: [email protected]
> Betreff: Re: wicket2 / multi-mounts to class
>
> the param didn't make any sense because the first param was
> only used to put in in a map and the string you put into the
> strategy is used in the decode and encode so having 2 params
> which are not the same don't make any sense. Because the urls
> generated then don't really map anymore on the param that is
> in the map.
>
> So what does the first param of mount in wicket 1.x really mean?
>
> why not just do one mount:
>
> mount(new IndexedParamUrlCodingStrategy("/global",Katalog.class));
>
> and then do anything you want after that??
>
> /global/x
> /global/y
> /global/z
>
> all go to one class, that is one mount.
>
> johan
>
>
>
> On 11/15/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > in wicket 1.x you can do following:
> >
> > mount("/de/", new IndexedParamUrlCodingStrategy("",Katalog.class));
> > mount("/en/", new IndexedParamUrlCodingStrategy("",Katalog.class));
> >
> > while in wicket 2.0 you only can do:
> >
> > mount(new IndexedParamUrlCodingStrategy("/de",Katalog.class));
> > mount(new IndexedParamUrlCodingStrategy("/en",Katalog.class));
> >
> > wich then means that you cant switch by the 0 - Param the path...
> > meaning if you enter /IndexA/Foo/Bar you cant have a link to
> > /IndexB/Foo/Bar by just using PageParams("0=Foo,1=Bar") (similar..)
> >
> > (the /de and /en here is the language for example)
> >
> >
> > is there a way to do this? else i would make a Jira
> featurerequest as
> > this behaviour is vital for me... i need to be able to have
> at least N
> > paths that are mounted to a single class and can then be
> switched by
> > the first request param.
> >
> > Best Regards
> >
> > Korbinian
> >
> >
> >
> >
>