Is RenderStrategy.ONE_PASS_RENDER a smart way to get rid of page options like? 1 in the Wicket app?

We have been using Wicket 1.3.7 for several years and are currently in the process of updating our project to 6.x wicket

I have done a lot of research regarding page parameters (e.g. ?1 ) added to each URL and how to get rid of them. (Unfortunately, I could not find detailed information about this in the official documentation.) However, I read a lot of statements (from the developers of Wicket and , such as

It is necessary to monitor the page version, otherwise it would be impossible to be able to

and

You need to make your pages idle in order to get rid of it.

It was also suggested to use the custom implementation of AbstractComponentMapper , overriding encodePageComponentInfo without adding a parameter. Which has an obvious lack of fatigue for the mounted page. (e.g. this SO answer )

Yesterday I came across RenderStrategy.ONE_PASS_RENDER .

I tried it, and after some testing I got the impression that this is the setting for "restoring the old gate": the page settings of the page disappeared, but my pages are incompatible.

Well, there is a drawback. If you have to take care of the dual-send issue yourself, but I can live with it.

Question: are there any other shortcomings that I do not know about? Expect any surprises?

This seems to be the perfect solution, I'm just wondering why there are so many discussions on how to get rid of these parameters, even with the developers of the gate, where it is not .

Thanks in advance.

+4
source share
1 answer

We followed a similar upgrade path, and my first reaction after the upgrade was "Woah, these are some nasty URLs ...".

Initially, we also switched to single pass rendering in order to have nicer URLs. But then, looking into it more, it turned out that "? Id" is more than just solving a problem with two errors.

Pages with Ajax components can be very dependent: since the user interacts with the page, you add components, delete others, etc. With the page ID in the URL parameters, you return the page in the same state as you, if you refresh the page (F5) or go to another page, then click the "Back" button.

You lose this function if you switch to single-pass rendering, since the browser cannot determine which page from the page store is targeted and usually ends with another instance of the page object.

This was especially noticeable on the "Listing Results" pages (pages displaying a list / table of "elements" with paging and Ajax filtering). On these single-pass rendering pages, you often lose your search criteria or return to the beginning of the results, even if you clicked “next page” several times.

We ended up using the “standard” rendering engine (rather than a single pass). URLs do not look so good, but we felt that the pros outweighed the cons (and href looked fine, this is just a string of browser URLs).

Another problem was the "crawlability" of our site. In order not to affect the Google 302 index or “url? Id”, we added the following code to our Wicket application launch method to force a one-pass rendering for Google Bot:

  setPageRendererProvider(new IPageRendererProvider() { @Override public PageRenderer get(RenderPageRequestHandler handler) { return new WebPageRenderer(handler) { @Override protected boolean isOnePassRender() { // To avoid 302s with Google Bot and have good SEO. String userAgent = ((HttpServletRequest) RequestCycle.get().getRequest().getContainerRequest()).getHeader("User-Agent"); if (StringUtils.contains(userAgent, "Googlebot")) { return true; } else { return super.isOnePassRender(); } } }; } }); 
+5
source

All Articles