It is difficult to know what you mean with "current page". There are at
least 3 possibilities:

- the page that is being rendered
- the page that is receiving the click/submit
- the page that is being redirected to

You could look at the JsonRequestLogger from wicket-extensions and its
super class.

Martijn


On Thu, Apr 2, 2026 at 11:52 AM mscoon <[email protected]> wrote:

> Hi all,
>
> A quick verification that
> using IRequestCycleListener#onRequestHandlerResolved() to add the page
> class to the logging context is the way to go.
>
> Sample code:
>
> public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler
> handler) {
>     if (handler instanceof RenderPageRequestHandler rprh) {
>          String page = rprh.getPageClass().getSimpleName();
>          [add to logging context]
>     } else if (handler instanceof ListenerRequestHandler lrh) {
>          Component c = (Component) lrh.getComponent();
>          Page pg = c.getPage();
>           String page = pg.getPageClass().getSimpleName();
>           [add to logging context]
>     }
> }
>
> Thank you in advance!
> Marios
>


-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Reply via email to