Question

I am trying to make a page of my project completely stateless (more pages to come) and by doing get rid of the page version number, e.g. /mypage/?0

The page sets statelessHint to true, I have also verified in onBeforeRender that isStateless returns true. I also use the @StatelessComponent annotation to make sure the page and its child components are really, really stateless.

So, it seems that everything is stateless, however the version parameter is still appended to the URL

I cannot attach the code, since it is a huge construct with many components and a lot of inheritance involved. Of course, I do not expect anyone to tell me where there problems is, but rather hope for some to give me a hint when to place a breakpoint in Wicket's sources to find out what is going wrong. E.g. can anybody tell me which Wicket class is responsible for deciding whether or not to append the version parameter?

Thanks in advance, Peter

Was it helpful?

Solution 2

Obviosuly, @StatelessComponent is not always reliable down into all child components :(

You can debug this by setting the log level for org.apache.wicket.Page to DEBUG, which adds loads of lines to your console output. Grep for "is not stateless because" to find messages about rendered components that are stateful.

In my case, it was an Image, whose getStatelessHint() method returned false (no idea why).

OTHER TIPS

To verify that pages are stateless you have to call Page#isPageStateless instead of Page#isStateless.

For the sake of completeness I'll also mention that the @StatelessComponent itself does nothing but you have to install the StatelessChecker with

getComponentPreOnBeforeRenderListeners().add(new StatelessChecker());

in Application#init. I think it works pretty well and it should find any stateful components.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top