Hi Lars,

mountPage("page2", Page2.class);
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
HttpsConfig(8080, 8443)));
mountPage("page3", Page3.class);

Now if I am at Page1 (http://localhost:8080/page1) and there I have
add(new BookmarkablePageLink<Void>("page2", Page2.class));
then the generated url is https://localhost:8443/page2 because the
HttpsMapper wraps the old root mapper that knows about Page2.

HttpsMapper doesn't
implement org.apache.wicket.request.mapper.ICompoundRequestMapper so when
mountPage(page3) is called Wicket creates a
new org.apache.wicket.request.mapper.CompoundRequestMapper that adds the
current root mapper (HttpsMapper) at position 1 and a MountedMapper for
Page3 at position 2. So requests to Page3 are not handled by HttpsMapper
and the generated urls are HTTP, not HTTPS.

HttpsMapper intentionally doesn't implement ICompoundRequestMapper exactly
for this reason - to make it possible to configure pages which should never
be secured.

Martin Grigorov
Wicket Training and Consulting

On Fri, Oct 14, 2016 at 2:48 PM, Lars Törner <lars.tor...@gmail.com> wrote:

> Hi,
> we had a problem where a bookmarkable link didn't become a https link.
> I found this:
> https://cwiki.apache.org/confluence/display/WICKET/How+
> to+switch+to+SSL+mode
> Which, with a warning,  states:
>  "It is extemtely important that when setting the rootRequestMapper it is
> done AFTER you have added any bookmarkable links otherwise they will not be
> switched over to Secure mode."
> I found that we in our Application.init() did the opposite, i.e. set the
> rootRequestMapper before the page mounting. Problem solved, I thought.
> Instead the problem was that the page wasn't mounted at all, and the only
> thing that worked was to mount the page and keep the order we had, which,
> according to the link and the warning above is bound to fail.
> Please, can anyone tell me what I'm missing here?
> Wicket version: 6.22.
> Cheers
> Lars

Reply via email to