本文介绍了删除网址中的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Wicket 1.5中引入的URL中删除或隐藏版本号?
How can I delete or hide the version number in the URL introduced in Wicket 1.5?
安装页面无济于事.
http://localhost/MyPage/SubPage?0
推荐答案
在Application.init()中:
In Application.init():
mount(new MountedMapperWithoutPageComponentInfo("/subpage", MyPage.class));
具有以下Mapper类:
with the following Mapper class:
public class MountedMapperWithoutPageComponentInfo extends MountedMapper {
public MountedMapperWithoutPageComponentInfo(String mountPath, Class<? extends IRequestablePage> pageClass) {
super(mountPath, pageClass, new PageParametersEncoder());
}
@Override
protected void encodePageComponentInfo(Url url, PageComponentInfo info) {
// do nothing so that component info does not get rendered in url
}
@Override
public Url mapHandler(IRequestHandler requestHandler)
{
if (requestHandler instanceof ListenerInterfaceRequestHandler ||
requestHandler instanceof BookmarkableListenerInterfaceRequestHandler) {
return null;
} else {
return super.mapHandler(requestHandler);
}
}
}
这篇关于删除网址中的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!