Hi Jeroen,

I just gave your quickstart a spin.

After some debugging I see that this is what happens: because you set the
redirect mode to ALWAYS_REDIRECT, wicket needs to generate a target url to
redirect to.
It determines if the page is stateless (in your case: yes), can be created
from a bookmarkable url (in your case: yes) and then generates a stateless
url (“/error”).

This makes sense: you basically tell wicket that this is a stateless page
that can be recreated easily.

So here are two possible ways for you to remedy this:

A) remove the stateless/bookmarkable constructor (the zero-args one)
B) explicitly mark the page as stateful (call "setStatelessHint( false );”
after “init(e);” in your stateful constructor

Since the error page requires an exception to be able to be of use - what
is the point of having the zero-args constructor?
So that would be the logical fix for me: remove the zero-arg constructor.

Hope this helps!

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 11 november 2021 bij 13:59:27, Jeroen Steenbeeke (
j.steenbeeke...@gmail.com) schreef:

Our application uses an implementation of IRequestCycleListener to redirect
users to a custom error page with contextual information (which includes a
reference to an external bug tracking system).

When the target page is also mounted in the application, we are seeing
rather unexpected behavior: the custom error page is created as expected,
but Wicket then tries to recreate the page by calling a default constructor
(which exists), rendering the error page without the contextual
information.

Is this expected behavior, or is this a bug?

I've created the following quickstart to illustrate the problem:

https://github.com/jsteenbeeke/wicket-custom-mounted-errorpage-loses-context

Sincerely,

Jeroen Steenbeeke

Reply via email to