How can I delete or hide the version number in the URL introduced in Wicket 1.5?
Mounting a page doesn\'t help.
http://localhost/MyPage/SubPage?0
For Wicket 8, this NoVersionMapper class works:
https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java#L314
public class NoVersionMapper extends MountedMapper {
public NoVersionMapper(final Class pageClass) {
this("/", pageClass);
}
public NoVersionMapper(String mountPath, final Class pageClass) {
super(mountPath, pageClass, new PageParametersEncoder());
}
@Override
protected void encodePageComponentInfo(Url url, PageComponentInfo info) {
//Does nothing
}
@Override
public Url mapHandler(IRequestHandler requestHandler) {
if (requestHandler instanceof ListenerRequestHandler || requestHandler instanceof BookmarkableListenerRequestHandler) {
return null;
} else {
return super.mapHandler(requestHandler);
}
}
}
This is basically the same as Devabc's code but this one compiles on Wicket 8. It has been tested against known regressions of the previous versions of the code: Ajax works and no page refreshing is triggered when it shouldn't.