[英]How to minimize generated urls in wicket?
For example, there is a table on the page.例如,页面上有一个表格。 The table is in the tab.
该表位于选项卡中。 The tab is in the panel and so on.
选项卡在面板中,依此类推。 The result is a hierarchy of dozens of components.
结果是数十个组件的层次结构。 In the table there is the column, and in the column there is some kind of component with a link, for example column sorter.
表中有列,列中有某种带有链接的组件,例如列排序器。
As a result, this link has very large URL, something like:结果,这个链接有非常大的 URL,类似于:
http://localhost:8080/mypage?5-1.-body-centerPanel-files-roll_down-panel-files-panel-repeater-3-item-form-table-topToolbars-toolbars-2-headers-2-header-orderByLink&id=94819
In fact the URL can reach several hundred characters.实际上 URL 可以达到几百个字符。
Is there a way to minify this URL to a reasonable size?有没有办法将此 URL 缩小到合理的大小?
I would like to achieve a URL like this:我想像这样实现 URL :
http://localhost:8080/mypage?sdsi93rh&id=94819
You can use a custom IRequestMapper that wraps the default root request mapper.您可以使用包装默认根请求映射器的自定义 IRequestMapper。 You can use HttpsMapper for inspiration.
您可以使用HttpsMapper获得灵感。
To set it up:要设置它:
setRootRequestMapper(new UrlShorteningMapper(getRootRequestMapper()));
The idea is to shorten the request url + query string in #mapRequest() method and to de-shorten it in #mapHandler().想法是在#mapRequest() 方法中缩短请求url + 查询字符串,并在#mapHandler() 中取消缩短它。
There are many articles in the web how to do url shortening. web 如何做 url 缩短中有很多文章。 Here is one
这是一个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.