Description
According to Wicket wiki it should be possible to implement application-specific markup loading by extending ResourceStreamLocator (https://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html). The method ResourceStreamLocator#locate returns an IResourceStream. Therefore it should be possible to return a custom FileResourceStream/StringResourceStream/...
However, whenResourceStreamLocator#locate returns anything else than the standard implementation this works only as long as the page inherits directly from WebPage.
When any markup inherited from another page is loaded, the following stack trace is printed:
ERROR - MarkupFactory - Markup not found: Base markup of inherited markup not found. Component class: my.package.HomePage. Enable debug messages for org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a list of all filenames tried.
org.apache.wicket.markup.MarkupNotFoundException: Base markup of inherited markup not found. Component class: my.package.HomePage. Enable debug messages for org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a list of all filenames tried.
at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:71)
at org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52)
at org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412)
at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:448)
...
ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. Component is not yet connected to a parent. [Page class = my.package.HomePage, id = 0, render count = 1]
at org.apache.wicket.Component.getMarkup(Component.java:736)
at org.apache.wicket.Component.internalRender(Component.java:2335)
at org.apache.wicket.Component.render(Component.java:2298)
at org.apache.wicket.Page.renderPage(Page.java:1010)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
...
The attached source shows this issue. HomePage is loaded without any problem. Clicking the link to view InheritingPage makes the error occur. When exactly the same html code is loaded from the standard file location there is no problem at all.