You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Mark Derricutt <ma...@talios.com> on 2008/01/11 23:05:45 UTC

How to write an IndexedParamUrlCodingStrategy that returns different pages?

Is wicket able to do the following?  I want to write a custom
UrlCodingStrategy based off IndexedParamUrlCodingStrategy that returns a
different page class depending on how deep into the path the request is.

For example, I want the path

  /level
  /level/1
  /level/2
  /level/3

to return the ViewLevelPage.class with a param 0 or 1/2/3

but if the request is

  /level/1/english

I want to use ViewSubjectPage with param 0 = 1, param 1 = english and so on
(with maybe /level/1/english/summary) returning yet another page.

Is this possible?  And if it is, is it also possible to say do
"setResponsePage(new ViewSubjectPage(...))" and have that ruturn the correct
url?

I guess, instead of IndexedParamUrlCodingStrategy which takes an infinite
number of parameters, I want an IndexedParamUrlCodingStrategy that takes a
finite set, that way I could write:

        mount(new IndexedParamUrlCodingStrategy("/level", 1,
ViewLevelPage.class));
        mount(new IndexedParamUrlCodingStrategy("/level", 2,
ViewSubjectPage.class));

Feasable or should I not bother fighting just use something like /level and
/subject paths?

Mark
-- 
Ambition is the last refuge of failure