Search code examples
performanceurlwicketwicket-1.6

Shorter link urls in Wicket


I am creating an application with a lot of links. Because the links are contained in cells in a table, the urls that are generated by Wicket tend to get long, making the page slower to load.

For example:

 <a href="./?0-2.ILinkListener-f-t-body-rows-11-cells-2-cell-li-35-link">2011-06-09 00:00:00.0</a>

I try to figure out where to start exploring the encoding / decoding of URLs, but it is rather complex material. My first approach was to just use 'short' names for components (like "t", "f" etc). I can imagine there is a better approach.

I can image it would be possible just to 'number' the links; as the page still exists, so I would end up with something like this:

 <a href="./?0-2.ILinkListener-1237">2011-06-09 00:00:00.0</a>

Are there solutions for my problem already out there, or can anyone point me to the right direction?


Solution

  • If a Javascript solution is acceptable, you can use a single event listener on the whole table instead of many links in the table.

    See this example for an inspiration:

    https://github.com/svenmeier/apachecon-wicket/tree/master/src/main/java/eu/apachecon/base/ui/performance

    Notice how the Ajax behavior transports dynamic extra parameters to the server. It looks for rows only though. if you need to distinguish between table cells being clicked, you'll have to expand on the idea.