Re: Mounting page to mutliple urls with different pageparameter

2011-11-07 Thread Martin Grigorov
On Mon, Nov 7, 2011 at 1:41 PM, heikki wrote: > thanks ! > > Adding a second IRequestMapper like that, rather than replacing the default > with a dual-function like I tried above, is so much simpler and works like a > charm. > > That being said, it turns out that it has no effect whether or not I

Re: Mounting page to mutliple urls with different pageparameter

2011-11-07 Thread heikki
thanks ! Adding a second IRequestMapper like that, rather than replacing the default with a dual-function like I tried above, is so much simpler and works like a charm. That being said, it turns out that it has no effect whether or not I override getCompatibilityScore(). See my implementation be

Re: Mounting page to mutliple urls with different pageparameter

2011-11-06 Thread Bas Gooren
Another way is to override some methods in MountedMapper (thus creating your AnotherPageMapper or something like that). Methods of interest: - getCompatibilityScore(): should only return 1 if the url starts with "b" or "c" See the default MountedMapper implementation, you could simply say: i

Re: Mounting page to mutliple urls with different pageparameter

2011-11-06 Thread heikki
hi, thanks for your explanation. As I want to restrict the possible paths to AnotherPage to /b and /c and not /xyz, I went for the IRequestMapper implementation. I now have an implementation that seems to work perfect, but I'm afraid it's not thread-safe and I'm not sure if I've understood things

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren
Well, the simplest solution would be: - set Index.class as your homepage (through the corresponding method in your application class) - use mount(new MountedMapper("/${param}", AnotherPage.class)); that should at least get "/b" and "/c" working. Unfortunately (?) that will also allow /xyz and

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Igor Vaynberg
On Fri, Nov 4, 2011 at 6:37 AM, Martin Grigorov wrote: > On Fri, Nov 4, 2011 at 3:17 PM, Bas Gooren wrote: >> The latter problem is logical: your mapping is focused on incoming requests. >> When wicket renders a link to AnotherPage.class, which url should be >> generated? >> >> My guess is that a

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
No need to extend MountedMapper. Just implement IRequestMapper and then use application.setRootRequestMapper(yourMapper) See how CryptoMapper works. On Fri, Nov 4, 2011 at 4:21 PM, heikki wrote: > sorry, just saw your reply about pastebin after posting. > > Here it is: http://pastebin.com/uRNyxZ

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
sorry, just saw your reply about pastebin after posting. Here it is: http://pastebin.com/uRNyxZbV. Thanks and kind regards Heikki Doeleman -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3990244.html Sent from the Users for

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
hi, thanks for your hints, but still I didn't get it to work. I have a RootRequestMapper that extends MountedMapper, and it overrides mapRequest() like so @Override public IRequestHandler mapRequest(Request request) { List segments = request.getUrl().getSegments(); if(Coll

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren
My eyes too :-) I was working on absolute urls the other day, and then came along this "pearl". But since you are the one who reported/created WICKET-3347 you've enjoyed the sight of this method before :-) But back on-topic: The TS should create a single root mapper which maps AnotherPage.cla

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
On Fri, Nov 4, 2011 at 3:17 PM, Bas Gooren wrote: > The latter problem is logical: your mapping is focused on incoming requests. > When wicket renders a link to AnotherPage.class, which url should be > generated? > > My guess is that a request for /b comes in, wicket then checks if the url is > va

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Bas Gooren
The latter problem is logical: your mapping is focused on incoming requests. When wicket renders a link to AnotherPage.class, which url should be generated? My guess is that a request for /b comes in, wicket then checks if the url is valid for AnotherPage.class by generating a url for it, whic

Re: Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread Martin Grigorov
Hi, Custom root request mapper should be able to do it. Just check the request's URL - if it has no segments then return the home page, if it has one segment then return new RenderPageRequestHandler(AnotherPage.class, new PageParameters().add("param", segmentValue)) On Fri, Nov 4, 2011 at 2:53 PM

Mounting page to mutliple urls with different pageparameter

2011-11-04 Thread heikki
hello, I still find URL mapping to be far from easy. I can't get the following mapping to work; all advice very much appreciated: intented mapping is: / --> map to IndexPage.class /b--> map to AnotherPage.class with pageparameter param="b" /c