wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Calling isPageStateless() can mess up the statelessness of a page
Date Fri, 10 Aug 2012 14:13:40 GMT

The page can become stateful during rendering, as you have noticed.
There is a code in WebPageRenderer that re-renders the page if it
change state during the first rendering because otherwise some
previously rendered links may became broken.

The real problem here is that #isPageStateless() does caching (by
using Page#stateless variable) and once set it doesn't bother asking
the components second time.

I see no reason to add restrictions related to the page's lifecycle.
This wont help.
The only solution that I see is to remove the caching and make this
call more expensive. But even in this case your logic wont work.
It will work only if your label is at the very bottom of the page.

On Fri, Aug 10, 2012 at 4:31 PM, Bertrand Guay-Paquet
<bernie@step.polymtl.ca> wrote:
> Hi,
> (Using Wicket 6.0-SNAPSHOT, or 1.5.7)
> I found a strange behavior when calling Page#isPageStateless(). I have a
> simple label in my personal wicket debug bar which displays "stateless" when
> a page is stateless. It works like so:
> new WebMarkupContainer("statelessMarker") {
>     @Override
>     protected void onConfigure() {
>         super.onConfigure();
>         setVisible(getPage().isPageStateless());
>     }
> };
> This worked great until I got by chance a page which was stateless except
> for ajax links which were children of a repeater. Here is what happens then:
> 1) onConfigure() is called which calls isPageStateless() and determines the
> page is stateless
> 2) onBeforeRender() is executed which populates the repeaters and adds
> stateful components to the tree
> 3) Since the page was determined stateless in 1), it stays that way
> 4) stateful ajax callback links do not work on the page
> Therefore, it seems that isPageStateless() should never be called before
> onBeforeRender() is executed or mayhem may ensue. However, after cursory
> inspection of callers of isPageStateless(), it looks like that is not always
> the case so I'm not certain.
> Should this be considered a bug? Should an assertion be made in
> isPageStateless() that onBeforeRender() was executed?
> Regards,
> Bertrand
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org

Martin Grigorov
Training, Consulting, Development

To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

View raw message