私はそれをテストで確認することを好みます。
ステートレス ページ オーバーライドの各テスト
getStatelessWebPage()
デフォルトでは null を返します。
次に、基本的なテストで、ページ上のすべてのコンポーネントにアクセスし、コンポーネントがステートレスかどうかを確認する一般的なテストを行います
@Test
public void checkForStateless()
{
StatelessWebPage statelessPage = getStatelessWebPage();
if (statelessPage != null)
{
Page page = (Page)statelessPage;
if (!page.isPageStateless())
{
//find the reason
Component statefulComponent = page.visitChildren(Component.class, new StatelessChecker());
if (statefulComponent != null)
{
fail("Stateless page contains stateful component ["
+statefulComponent.getClass().getName()+" : "
+ statefulComponent.getMarkupId() +"]");
}
}
}
}
と
class StatelessChecker implements IVisitor<Component, Component>
{
@Override
public void component(Component component, IVisit<Component> iVisit)
{
if (!component.isStateless())
{
iVisit.stop(component);
}
}
}