I'm working on Wicket 8.* migration when I struggle on onRequestHandlerResolved() under IRequestCycleListener method conversion.
As per my structure of logic in my code wicket 7.15.0
public class MyRequestCycleListener extends AbstractRequestCycleListener{
//All methods override here
@Override
public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler) {
if (handler instanceof ListenerInterfaceRequestHandler) {
ListenerInterfaceRequestHandler requestHandler = (ListenerInterfaceRequestHandler) handler;
if (requestHandler.getListenerInterface().getListenerInterfaceClass().isAssignableFrom( IFormSubmitListener.class)) {
//here made some login as well as every onSubmit
}
}
}
}
As wicket 8.* changes AbstractRequestCycleListener class converts to IRequestCycleListener interface ListenerInterfaceRequestHandler renamed to ListenerRequestHandler Deprecates RequestListenerInterface and also IFormSubmitListener makes error
How to convert code to migration on wicket 8.9.0 ?
It should be something like this:
public class MyRequestCycleListener implements IRequestCycleListener{
@Override
public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler) {
if (handler instanceof ListenerRequestHandler) {
ListenerRequestHandler requestHandler = (ListenerRequestHandler) handler;
if (requestHandler.getComponent() instanceof Form) {
//here made some login as well as every onSubmit
Form form = (Form) requestHandler.getComponent();
}
}
}
}