Hi,

It won't work as you did it.
Wicket's IRequestMapper uses #getCompatibilityScore() to decide which
mapper to use to handle a request. If the scores for several mappers are
the same then the order of their definition is used. Since "test3" is added
last it has the highest priority. Later when Wicket needs to create a Url
to a page (class) the mapper with the highest priority will be used.

A simple workaround for you is to define 3 additional pages which just
extend MyPageClass. They will have only the same constructors as
MyPageClass, nothing more. Even the markup will be inherited. This way you
can use different page types for the different urls.

You can use

 #mountPage("/test1.html", MyPageClass1.class)

instead of

ICompoundRequestMapper mapper = getRootRequestMapperAsCompound();
mapper.add(new MountedMapper("/test1.html", MyPageClass1.class));

It is the same.



On Fri, May 31, 2013 at 12:40 AM, josho <josh.oliv...@hotmail.com> wrote:

> Hello all,
>
> I have been using Wicket for about 1 year now for our company website. It
> has been working great. Recently we have decided to make the switch from
> Wicket 1.4.22 to 6.8.0. After moving all the code to the new library we are
> still having 1 problem. I am mounting several html pages against the same
> class (they all require some login/cart information to be generated by
> wicket, but have different content) like so:
>
> ICompoundRequestMapper mapper = getRootRequestMapperAsCompound();
> mapper.add(new MountedMapper("/test1.html", MyPageClass.class));
> mapper.add(new MountedMapper("/test2.html", MyPageClass.class));
> mapper.add(new MountedMapper("/test3.html", MyPageClass.class));
>
> When I attempt to access "/test1.html" or "/test2.html" in my browser, the
> server sends a 302 Redirect to "/test3.html" (the last page mounted). All
> my
> other classes with unique names are accessible (all extend this class as
> well).
>
> I have extended the ResourceStreamLocator class, and am filtering on URL,
> however the locator never recieves the first request. Previously we worked
> around this issue by not allowing "MyPageClass.class" to have cached
> markup.
> However that solution is no longer working. I have made several searches on
> Google and nabble for a solution, but no one seems to be in the same boat
> as
> me.
>
> Any help is appreciated.
>
> -Josh
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once-tp4659173.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
>
>

Reply via email to