In my application I mount following URL:
this.mountPage("/details/${site}", MerchantDetailPage.class);
So a request to for instance ../details/anything will create an instance of MerchantDetailPage with pageparameter: site=anything.
The constructor of MerchantDetailPage:
public MerchantDetail(final PageParameters parameters) {
super();
org.apache.wicket.util.string.StringValue storeParameter = parameters.get("site");
if (!storeParameter.isEmpty()) {
this.store = this.service.getStoreByQBonSiteWithCategoriesDescriptionsRegionAndAddress(storeParameter.toString());
}
if (store == null) {
throw new RestartResponseAtInterceptPageException(Application.get().getHomePage());
}
// Build the page
this.createPage(this.store, null);
}
This seemed to work fine until I noticed that the constructor was called 4 times. After some digging I found that the constructor was called once with parameter site=anything but then another 3 times for 3 images that are on the page; e.g.:
<img wicket:id="store_no_image" src="./images/shop_no_logo_big.png" alt="logo" />
So, for this resource Wicket is also calling this page but with parameter: site=images.
As a consequence, the store is null
so the request for the image is redirected to the homepage => the image is not found.
Why is this happening? Why is wicket trying to treat a resource request through a page mount?
Some side comments:
Well... your page resides at
/detail/anything
which is correctly mapped to your merchant detail page...
Your images reside at
/detail/images/shop_no_logo_big.png
and similar, which is correctly mapped to your merchant detail page... The mount path doesn't know and doesn't care if it's a page request or a resource request. For all it is worth it could be the case that you're using the mount path to create the resource dynamically...
So the solution is to move your images to a location that doesn't match yout mount-path.