delete version number in url

前端 未结 7 2014
广开言路
广开言路 2020-11-27 05:52

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


        
相关标签:
7条回答
  • 2020-11-27 06:38

    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.

    0 讨论(0)
提交回复
热议问题