0

Wicket offeres these concepts for pages and page links (afaik):

Bookmarkable Links do not depend on any session information. The URL may not contain session ids, version numbers, etc.

Stateful Pages are stored on the server so they can be used later in the session (e.g. for AJAX communication or for the browser's back function). Stateless pages are always created freshly for each request.

Page Versioning creates one version of a page instance per request and stores it in the session. Each version has a session unique id that is used in the page links to address a specific version directly. The url looks like that (the '8' indicated the 8th version of the profile page within this session): http://.../wicket7/profile?8

The Wicket documentation mentions these dependencies:

  • Stateless pages have always bookmarkable links (makes sense...)
  • Non-bookmarkable links point always to stateful pages (ok, the logical inverse...)
  • Stateful pages may have both, bookmarkable and non-bookmarkable links

It seems that stateful pages are always versioned. But I believe that there are situation where you want your pages stored, but not versioned. Furthermoree it seems to me that versioned pages have no bookmarkable link since the version id relies on the session. So this is my questions:

Are stateful pages always versioned? Is there a good practice to switch off versioning but keep storing stateful pages?

Frank Henningsen
  • 183
  • 2
  • 11
  • What is it you don't want, to store multiple versions of a page, or to append the URL with a number? – tetsuo Oct 27 '13 at 13:23
  • Well both: Versioning requires the page id in the url (like "...profile?8") and that makes them non-bookmarkable (for me a disadvantage). If I do not need versioning then I would like the ids to disappear from the url (they are not necessary). This would lead to bookmarkable urls. Does that make sense? How can I achieve that? – Frank Henningsen Oct 28 '13 at 14:06
  • The `?8` doesn't prevent bookmarking, nor recreating the state of the page. It merely tells Wicket that the page is the 8th in the session and that there's associated state involved. But if your page is mounted under e.g. `/profile` and has a no-args constructor (or a constructor with PageParameters) then Wicket is able to instantiate the page and the `?8` will be changed to whatever is currently the page pointer for the session. – Martijn Dashorst Jan 30 '18 at 19:09

1 Answers1

2

Frank,

If you don't want to have "version" in url I recommend to add following code to your Application.init

getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

Look into RenderStrategy for more information.

Ilya Naryzhnyy
  • 308
  • 1
  • 7