Thx!

On Sat, 23 Apr 2011 14:11:56 +0300, Alexandros Karypidis <[email protected]> wrote:

Hello,

Could you post some pseudo-code on what your request mapper looks like? I have a similar use-case but I wasn't able to follow. I created a "MyRequestMapper" class that wraps the default root mapper:

        setRootRequestMapper(new MyRequestMapper(getRootRequestMapper()));


public class MyRequestMapper implements IRequestMapper {
        private final IRequestMapper wrappedMapper;


        public MyRequestMapper(IRequestMapper wrappedMapper) {
                this.wrappedMapper = wrappedMapper;
        }
...
mapRequest()
mapHandler()
getCompativilityScore()
...
}

Currently I delegate to the "wrapped" handler. What I would like to do is peek at the URL (i.e. request.getUrl()), then decide based on some logic which page to render. However, mapRequest() returns an "IRequestHandler". I would've liked to return same page class like this:


        @Override
        public IRequestHandler mapRequest(Request request) {
                List<String> segments = request.getUrl().getSegments();
                if (existsPerson(segments.get(0)) {
==>                          return PersonPage.class;
                } else if (existsProduct(segments.get(0)) {
==>                          return ProductPage.class;
                }
                return wrappedMapper.mapRequest(request);
        }

How would I go about doing that?

On Fri, 22 Apr 2011 23:48:54 +0300, drewzilla80 <[email protected]> wrote:

Thanks, Martin. That's what I already ended up doing as it turns out (I dug
into the code and noticed the method you specified). I've got my whole
original use case working very nicely indeed - thanks for your help.

dz

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to