API / Apache Wicket Interview questions
Explain the internal working of Wicket's URL mounting?
By default, a bookmarkable page's URL looks like an internally-generated path tied to its class; mounting replaces that with a clean, human-readable pattern by registering an explicit mapping between a URL template and a page class.
A call like mountPage("/search/${term}", SearchPage.class) in the Application's init() registers that pattern with Wicket's chain of IRequestMapper implementations. On each incoming request, the mappers are checked in order (most specific patterns generally win) until one matches the URL's path structure; the matching mapper then extracts whatever segments the pattern defines (${term} here) into a PageParameters object and uses it to construct the target page, exactly as if that page had been reached through its default, unmounted URL.
Because this is just a mapping layer sitting in front of the same page-construction mechanism, mounting doesn't change how the page itself is written — the same SearchPage(PageParameters) constructor works whether it's reached via the default generated URL or a friendly mounted one.
More Related questions...