Well, then you will inevitable run into problems when the pageId is
missing in the url and the freshly created page has a different
component structure.
Yes, for many pages this is unlikely, but I wouldn't like to a have a
setting for that:
pageSettings.setDoNotEncodePageIdForMountedPagesDisclaimerIknowThatThisMightBreakLaterOn(true);
Regards
Sven
On 29.10.21 19:53, Thomas Heigl wrote:
Hi Sven,
if your pages are stateless, no pageid will appear anyways - so why
bother with a custom mapper?
Our public and SEO pages are stateless, but once you are logged in, the
pages are much too complex to be fully stateless with Wicket's current
support for stateless ajax.
-t
On Fri, Oct 29, 2021 at 3:59 PM Sven Meier <s...@meiers.net> wrote:
Hi Thomas,
>and only page parameters are used for state
if your pages are stateless, no pageid will appear anyways - so why
bother with a custom mapper?
Sven
On 29.10.21 15:17, Thomas Heigl wrote:
Hi Andrea,
I have been using NoPageIdMapper mapper for many years in all of my
projects. It works fine if all pages are mounted and only page parameters
are used for state.
I've also found that some popular Wicket projects like OneDev or
Orienteer
adopt a similar solution. So I'm starting to wonder if we should
consider
to provide a standard solution for those who are interested in this
kind of
behavior.
I think it would make sense to provide it out of the box, as a separate
mapper or a configuration option for `MountedMapper`. Every project that
wants/needs clean URLs probably uses this snippet in some form.
-t
On Fri, Oct 29, 2021 at 1:28 PM Andrea Del Bene <an.delb...@gmail.com>
wrote:
In my current project I'm building a web app which is essentially made
of
pages mounted at a precise path which I guess it's a quite common design
pattern with Wicket and web apps in general. Shortly after starting to
work
on this project I was asked to get rid of the page id to make page urls
more "clean".
This is something that it's relatively easy to achieve, and it has also
been discussed different times on StackOverflow and on our mailing list.
Essentially we have to create a custom MountedMapper overriding
encodePageComponentInfo in order to skip pageInfo. Something like:
public class NoPageIdMapper extends MountedMapper {
@Override
protected void encodePageComponentInfo(Url url, PageComponentInfo info)
{
if (info.getComponentInfo() != null) {
super.encodePageComponentInfo(url, info);
}
}
}
I've also found that some popular Wicket projects like OneDev or
Orienteer
adopt a similar solution. So I'm starting to wonder if we should
consider
to provide a standard solution for those who are interested in this
kind of
behavior.
WDYT?
--
Andrea Del Bene.
Apache Wicket committer.