Wicket
  1. Wicket
  2. WICKET-5426

Page not recognized as stateless although stateful component is hidden in #onConfigure()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.12.0, 7.0.0-M1
    • Fix Version/s: 6.13.0, 7.0.0-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      Page#stateless gets cached. If Page#isStateless() is called before rendering, a page might not be considered stateless although in #onConfigure() all stateful components are hidden.

        Issue Links

          Activity

          Hide
          Sven Meier added a comment -

          stateless cache is now cleared in Page#onBeforeRender() regardless of its previous value

          Show
          Sven Meier added a comment - stateless cache is now cleared in Page#onBeforeRender() regardless of its previous value
          Hide
          Martin Grigorov added a comment -

          That is, remove the check completely and always set stateless to null.
          I think this will be more correct behavior.

          Show
          Martin Grigorov added a comment - That is, remove the check completely and always set stateless to null. I think this will be more correct behavior.
          Hide
          Sven Meier added a comment - - edited

          Now as to the actual problem...

          Page#onBeforeRender() resets the cached stateless already:

               @Override
               protected void onBeforeRender()
               {
                    ...
                    // if the page is stateless, reset the flag so that it is tested again
                    if (Boolean.TRUE.equals(stateless))
                    {
                         stateless = null;
                    }
                    ...
               }
          

          Why don't we do this for FALSE too? This would fix this issue.

          Show
          Sven Meier added a comment - - edited Now as to the actual problem... Page#onBeforeRender() resets the cached stateless already: @Override protected void onBeforeRender() { ... // if the page is stateless, reset the flag so that it is tested again if ( Boolean .TRUE.equals(stateless)) { stateless = null ; } ... } Why don't we do this for FALSE too? This would fix this issue.
          Hide
          Martin Grigorov added a comment -

          Thanks, Sven !

          Show
          Martin Grigorov added a comment - Thanks, Sven !
          Hide
          Sven Meier added a comment -

          I've changed WebPageRenderer so that #isPageStateless() is no longer called if not needed.

          Thus we now have the same situation as in Wicket 6.x.

          Show
          Sven Meier added a comment - I've changed WebPageRenderer so that #isPageStateless() is no longer called if not needed. Thus we now have the same situation as in Wicket 6.x.
          Hide
          Sven Meier added a comment - - edited

          The regression of ONE_PASS_RENDER is caused by commit 22f1e04:

          WICKET-3347 Simplify ... WebPageRenderer.respond()

          Now #isPageStateless() is called prematurely in line #215 of WebPageRenderer.

          Even worse, for a PageProvider with a pageClass only, the page instance gets created unnecessarily in case of a redirect .

          Show
          Sven Meier added a comment - - edited The regression of ONE_PASS_RENDER is caused by commit 22f1e04: WICKET-3347 Simplify ... WebPageRenderer.respond() Now #isPageStateless() is called prematurely in line #215 of WebPageRenderer. Even worse, for a PageProvider with a pageClass only, the page instance gets created unnecessarily in case of a redirect .
          Hide
          Sven Meier added a comment -

          See WicketTesterLazyIsPageStatelessBase and subclasses.

          Show
          Sven Meier added a comment - See WicketTesterLazyIsPageStatelessBase and subclasses.
          Hide
          Sven Meier added a comment -

          related bug in BaseWicketTester

          Show
          Sven Meier added a comment - related bug in BaseWicketTester

            People

            • Assignee:
              Sven Meier
              Reporter:
              Sven Meier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development