yeah, but you forgot to put the appropriate first (and following) page param
to it:
"/path/to/page2" -> these are the prePageParams for me here, that i grab
each time i use a new one...
so you manually change your link to be at the mountpoint...
URLs are build like that: preParams / postParams
while the first part of the preParams is the mountpoint...
i didnt consider it a bug, but a big feature as it also allows even the most
complicated URL creation schemes as well as more enhanced CodingStrategies
regards
PS:
mount("/path/to/page2", new
> BookmarkablePageRequestTargetUrlCodingStrategy("", Page2.class,null));
is IMHO not a mountpoint but a pain - a mountpoint is a "short" description
of what comes to a page
e.g: "/path/" would be enough here... everything of a URL is logic - and
that has to be handled by the appropriate class and not coded fixed into a
init function
> -----Ursprüngliche Nachricht-----
> Von: Johan Compagner [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 16. November 2006 00:06
> An: [email protected]
> Betreff: Re: wicket2 / multi-mounts to class
>
> If that works somehow for you then that a bug and should be
> fixed It is not a feature
>
> i just tried it in the nice url example and it is exactly how
> i expected it to happen:
>
> i changed these 2 lines:
>
> // mountBookmarkablePage("/a/nice/path/to/the/first/page",
> Page1.class);
> // mountBookmarkablePage("/path/to/page2.html", Page2.class);
>
> into this:
>
> mount("/path/to/page2", new
> BookmarkablePageRequestTargetUrlCodingStrategy("", Page2.class,null));
> mount("/other/to/page1", new
> BookmarkablePageRequestTargetUrlCodingStrategy("/other2/to/page1",
> Page1.class,null));
>
> and what a suprice
> the link to page2 is just to root of the webapp (so clicking
> on the page2 link will just give me the index/homepage of the
> niceurl example) clicking on page1 will give me an error page
> ofcourse HTTP Status 404 -
> ------------------------------
>
> *type* Status report
>
> *message*
>
> *description* *The requested resource () is not available.*
>
>
> And this is also logical ofcourse because the url that is generated:
> /other2/to/page1 can't be resolved because there is no mount
> path resolving to that.
>
> johan
>
>
>
> On 11/15/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote:
> >
> > > It just has to be in sync. So thats why i removed that
> param in the
> > > mount.
> >
> > thats the point !
> >
> > currently you can take it out of sync in wicket 1.2.x if you want -
> > while in 2.0 you're forbidden to do so -> loss of functionality
> >
> > the thing that i do is to hold a (pre)PageParam in my
> session and add
> > it at the beginning of the params
> >
> > e.g: params = (somesession)getSession().getNewParams;
> > params.add(Integer.toString(params.size()),"foo");
> > while in the session the params are hold all over - so i
> can initalize
> > language and have it before the page, letting the website urls look
> > multilanguaged
> >
> > e.g:
> > /en/index
> > /de/index
> > /fr/index
> >
> > if you look at a URL paradigm then it has a preParameter, a
> Page and a
> > postParameter
> >
> > -> /pre/page/post
> > so what i do is to hook on the pre Part and mount it to it,
> the page
> > is a category-key from the database and the post-params are further
> > config params to it
> >
> > > 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));
> >
> > well - its strange but it works. I can send you a small
> demoApp if you
> > would like to see, and i really like the paradigm where the
> URL is as
> > clear as possible... and by using a config singleton i can find out
> > everytime in every component wich param is good for it (as
> all numbers
> > in that way are relative to the ones you specify in the prePart)
> >
> > Regards
> >
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Johan Compagner [mailto:[EMAIL PROTECTED]
> > > Gesendet: Mittwoch, 15. November 2006 22:22
> > > An: [email protected]
> > > Betreff: Re: wicket2 / multi-mounts to class
> > >
> > > 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
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
>