On Mon, Nov 7, 2011 at 1:41 PM, heikki <tropic...@gmail.com> 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
> override getCompatibilityScore(). See my implementation below. If I do not
> override mapRequest() to check the url and return null, it accepts all URLs
> like /xyz (using Wicket 1.5.2).
>
> In any case, everything works fine now for me. Thanks a lot !
>
> for reference, my code :
>
> in Application:
>
>        mount(new AnotherPageRequestMapper("/${param}", AnotherPage.class));
>
> and the impl:
>
>       import org.apache.wicket.request.IRequestHandler;
>       import org.apache.wicket.request.Request;
>       import org.apache.wicket.request.component.IRequestablePage;
>       import org.apache.wicket.request.mapper.MountedMapper;
>
>       public class AnotherPageRequestMapper extends MountedMapper{
>
>              public AnotherPageRequestMapper(String mountPath, Class<?
> extends IRequestablePage> pageClass) {
>                     super(mountPath, pageClass);
>    }
>
>              public IRequestHandler mapRequest(Request request) {
>                     String url = request.getUrl().toString();
>                     if(url.startsWith("b")) {
>                            return super.mapRequest(request);
>                     }
>                     else {
>                            return null;
>                     }
>              }
>
>              /**
>               * it does not make a difference, in practice, what this
> method returns (?!).

read the documentation of this method to understand what it is for.

>               */
>              public int getCompatibilityScore(Request request) {
>                     String url = request.getUrl().toString();
>                     if(url.startsWith("b")) {
>                            return 1;
>                     }
>                     else {
>                            return 0;
>                     }
>              }
>       }
>
>
>
> kind regards
> Heikki Doeleman
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Mounting-external-pages-to-root-tp3890756p3998358.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



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

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

Reply via email to