Reputation: 1693
I have a wicket application (version 6.10) deployed in Tomcat7: myapp.war
web.xml has following configuration:
<filter>
<filter-name>myapp.wicket</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.myapp.MyWebApp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>myapp.wicket</filter-name>
<url-pattern>/pages/*</url-pattern>
</filter-mapping>
So I can access wicket pages like
http://myhost/myapp/pages/HomePage
Untill here everything works fine. I mount my pages in MyWebApp.init()
like this:
mountPackage("/", HomePage.class);
and I am able to access HomePage as well as the other pages in the same package as specified above.
The problem arrives when I try to mount pages in a different package com.myapp.mobile If I use same strategy as before, it does not work at all:
mountPackage("/m/", MobilePage.class);
When I try to access MobilePage, I get an exception:
http://myhost/myapp/pages/m/MobilePage
WicketObjects.resolveClass WARNING Could not resolve class [com.myapp.m]
java.lang.ClassNotFoundException: com.myapp.m
And the same for any other page in the same package (all of them are Bookmarkable). However if I mount them one by one:
mountPage("/m/MobilePage", MobilePage.class);
mountPage("/m/MobilePage2", MobilePage2.class);
, or if I mount them in the root, it works:
mountPackage("/", MobilePage.class);
in the former case accessing them with the myapp/pages/m/MobilePage
and in the latter without /m/ : myapp/pages/MobilePage
So my question here is (and sorry for long explanation): how to mount a new package under a desired path (/m/ in this case)?
Thanks
Upvotes: 2
Views: 1790
Reputation: 1693
Instead of calling the method with '/m/' path, do it without last slash, so
mountPackage("/m", MobilePage.class);
works just fine...
One day lost for this :(
Upvotes: 1
Reputation: 3058
I have personally not used this syntax, but you might try it:
public final void mount(String path, PackageName packageName)
This seems to address what you are looking for.
You would write it like this:
public final void mount("/m/", PackageName.forClass(MobilePage.class));
Regards
Upvotes: 1