Wicket
  1. Wicket
  2. WICKET-5014

Changes in WicketObjects.sizeof(final Serializable object) clashes with <header-contribution> in AjaxResponse

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.3.0, 6.4.0, 6.5.0
    • Fix Version/s: 6.6.0, 1.5.10
    • Component/s: wicket, wicket-devutils
    • Labels:
      None

      Description

      I am currently developing on a RIA with wicket. Therefore 90 % of our request are Ajax-based.

      In my development process I start the application with the development configuration and I like to display the DebugBar in our page. I implemented an AjaxRequestTargetListener that adds the DebugBar to the AjaxRequestTarget each time an ajax call is done. This AjaxRequestTargetListener is added and initialized in the Application as follows:

      getAjaxRequestTargetListeners().add(new AjaxUpdateRequestTargetListener())

      This configuration worked fine for every wicket version until 6.3.0. Then I got problems with the XMLAjaxResponse. The "header-contribution"-XML Element does not get rendered in the AjaxResponse anymore and the corresponding HeaderItems of the ajax-updated components do not get rendered into the page.

      After some debugging I found out, that the problem is connected with the "WicketObjects.sizeof" method change in version 6.3.0:
      The method is called in the PageSizeDebugBarPanel for the whole page. That is why the onDetach method is called on every component of the page. Also the onDetach method is called on the HtmlHeaderContainer where the HeaderResponse gets resetted to 'null'. So every HeaderItem added to the HeaderResponse so far gets lost and no "header-contribution" XML-Element is rendered to the AjaxResponse.

      To understand this problem a little bit easier, I will add a quickstart example to this issue.

      1. wicket-quickstart.zip
        21 kB
        Christian Wellekötter

        Activity

        Hide
        Christian Wellekötter added a comment - - edited

        I added the quickstart to the described issue.

        If you take a closer look into the quickstart you will see a Label with an AjaxSelfUpdatingTimerBehavior. The Label itself is an anonymous implementation where I overwrote the "renderHead(IHeaderResponse)" method. In this method I added an OnDomReadyHeaderItem.forScript to change the background color of the Label. You can see that the background color is changed after the initial page load. After the ajax response the label gets replaced but the background color does not change because the "header-contribution" is missing in the AjaxResponse.

        Show
        Christian Wellekötter added a comment - - edited I added the quickstart to the described issue. If you take a closer look into the quickstart you will see a Label with an AjaxSelfUpdatingTimerBehavior. The Label itself is an anonymous implementation where I overwrote the "renderHead(IHeaderResponse)" method. In this method I added an OnDomReadyHeaderItem.forScript to change the background color of the Label. You can see that the background color is changed after the initial page load. After the ajax response the label gets replaced but the background color does not change because the "header-contribution" is missing in the AjaxResponse.
        Hide
        Martin Grigorov added a comment -

        The objects will be cloned before detaching them and measuring their size from now on, so the original component wont be detached.

        Show
        Martin Grigorov added a comment - The objects will be cloned before detaching them and measuring their size from now on, so the original component wont be detached.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Christian Wellekötter
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development