Hi folks,

I've committed two classes that improve Wicket mounted URLs in a
significant way. The URLs stay bookmarkable even after clicking a link
or submitting form, and the AJAX changes are preserved on reload.

Basically, what does is that when you hit a bookmarkable page such as
/my/mount/point
you are immediately redirected to *
/my/mount/point|3|
where |3| is the pageId. The URL is fully bookmarkable. The pageId in
URL is ignored if page with given ID doesn't exist in session or
doesn't match the mount point. Also this preserves the initial page
parameters, so

/my/mount/point/param1/value1 becomes /my/mount/point/param1/value1|3|.

The | separators are configurable and can be changed to e.g. (3) or
anything else you want. (Although [ ] get escaped so it doesn't look
pretty).

Good thing is that the URL remains stable and bookmarkable during the
whole page existence, so you no longer see the ?wicket:interface=:3:::
string in your URL.

Usage is very simple, you just need to mount the page using
HybridUrlCodingStrategy, e.g.

mount(new HybridUrlCodingStrategy("ratings", RatingsPage.class));
mount(new IndexedHybridUrlCodingStrategy("todo-list", TodoList.class));

I've already change all Ajax examples to use this strategy, so to see
it in action you just update wicket and wicket-examples from SVN, or
wait until we redeploy the live examples.

-Matej

* The redirect is necessary for pages with AJAX stuff, so that the
page instance is preserved on reload (otherwise with bookmarkable URL
new instance of page would be created on every reload, which discards
the AJAX changes)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to