wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Guay-Paquet <ber...@step.polymtl.ca>
Subject Calling isPageStateless() can mess up the statelessness of a page
Date Fri, 10 Aug 2012 13:31:52 GMT
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


Mime
View raw message