supportedPageExtensions.contains(pathInfo.extension))
{
// Obviously a href like href="myPkg.MyLabel.html" will do as
// well. Wicket will not throw an exception. It accepts it.
Page page = container.getPage();
final IClassResolver defaultClassResolver = page.getApplication()
.getApplicationSettings()
.getClassResolver();
String className = Packages.absolutePath(page.getClass(), pathInfo.path);
className = Strings.replaceAll(className, "/", ".").toString();
if (className.startsWith("."))
{
className = className.substring(1);
}
try
{
final Class<? extends Page> clazz = (Class<? extends Page>)defaultClassResolver.resolveClass(className);
return new AutolinkBookmarkablePageLink<Void>(autoId, clazz,
pathInfo.pageParameters, pathInfo.anchor);
}
catch (ClassNotFoundException ex)
{
log.warn("Did not find corresponding java class: " + className);
// fall through
}
// Make sure base markup pages (inheritance) are handled correct
MarkupContainer parentWithContainer = container;
if (container.getParent() != null)
{
parentWithContainer = container.findParentWithAssociatedMarkup();
}
if ((parentWithContainer instanceof Page) && !pathInfo.path.startsWith("/") &&
new MarkupStream(page.getMarkup()).isMergedMarkup())
{
IMarkupFragment containerMarkup = container.getMarkup();
MarkupStream containerMarkupStream = new MarkupStream(containerMarkup);
if (containerMarkupStream.atTag())
{