You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Oscar Besga Arcauz <ob...@isdefe.es> on 2012/09/18 10:05:44 UTC

Mounting pages

Hi wickers !


I'm using wicket 6, if anyone can help with a problem with mapping pages and web resources
I've been reading about it, but I can't find a way to make a web work as I want
+ http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
+ http://wicketinaction.com/2011/07/wicket-1-5-request-mapper/
+ https://cwiki.apache.org/confluence/display/WICKET/Request+mapping


I want to have two pages, Page1.class and Page2.class, Page1.class will collect every petition, except '/mynews' that will be answered by Page2.class and images and other resources (javascript, flash and videos, etc. )

In my WebApplication class, in the init() method, I've tried:

public void init() {
  mount(new MountedMapper("/${parameter1}/#{parameter2}",Page1.class)); 
  mount(new MountedMapper("/${parameter1}",Page1.class)); 
  mount(new MountedMapper("/myNews", Page2.class));
}

But always answers Page1.class
I've tried the opposite: to mount Page2.class first, and other combinations; the result is the same.


¿ anyone knows why ? 


Also, sometimes the url {Page1.class}/var1/var2 is redirected to {Page1.class}?parameter1=var1&parameter2=var2 this is a thing I hate specially


Thank for your help



    > > > Oscar Besga Arcauz  < < < 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Mounting pages

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Mapping on the root (/) with parameters in the request path is tricky ..

One way is to mount a custom root mapper that will check the url
segments and decide which page to use. See CryptoMapper and
HttpsMapper for demo of custom root mappers.

Another way is override #getCompatibilityScore() for your
MountedMappers below and the second one should return a higher value
if there is only one segment and its value is "myNews"

On Tue, Sep 18, 2012 at 11:05 AM, Oscar Besga Arcauz <ob...@isdefe.es> wrote:
> Hi wickers !
>
>
> I'm using wicket 6, if anyone can help with a problem with mapping pages and web resources
> I've been reading about it, but I can't find a way to make a web work as I want
> + http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
> + http://wicketinaction.com/2011/07/wicket-1-5-request-mapper/
> + https://cwiki.apache.org/confluence/display/WICKET/Request+mapping
>
>
> I want to have two pages, Page1.class and Page2.class, Page1.class will collect every petition, except '/mynews' that will be answered by Page2.class and images and other resources (javascript, flash and videos, etc. )
>
> In my WebApplication class, in the init() method, I've tried:
>
> public void init() {
>   mount(new MountedMapper("/${parameter1}/#{parameter2}",Page1.class));
>   mount(new MountedMapper("/${parameter1}",Page1.class));
>   mount(new MountedMapper("/myNews", Page2.class));
> }
>
> But always answers Page1.class
> I've tried the opposite: to mount Page2.class first, and other combinations; the result is the same.
>
>
> ¿ anyone knows why ?
>
>
> Also, sometimes the url {Page1.class}/var1/var2 is redirected to {Page1.class}?parameter1=var1&parameter2=var2 this is a thing I hate specially
>
>
> Thank for your help
>
>
>
>     > > > Oscar Besga Arcauz  < < <
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org