You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2016/09/20 13:04:20 UTC

[jira] [Resolved] (WICKET-6246) WebSocket request while Ajax request leads to error regarding HtmlHeaderCotnainer

     [ https://issues.apache.org/jira/browse/WICKET-6246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier resolved WICKET-6246.
--------------------------------
       Resolution: Fixed
         Assignee: Sven Meier
    Fix Version/s: 6.25.0

Since WICKET-6162 the original header container is restored after a partial page update. This fixes this issue too, so I applied the change to 6.x too.

> WebSocket request while Ajax request leads to error regarding HtmlHeaderCotnainer
> ---------------------------------------------------------------------------------
>
>                 Key: WICKET-6246
>                 URL: https://issues.apache.org/jira/browse/WICKET-6246
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.24.0
>            Reporter: Thomas Chrenko
>            Assignee: Sven Meier
>              Labels: header, header-contribution
>             Fix For: 6.25.0
>
>         Attachments: quickstart.zip
>
>
> There is a problem with header contribution with leads to a "Cannot replace a component which has not been added: id='_header_'...." error.
> Short:
> - Add at least two components to an AjaxRequestTarget
> - The (at least) second component must initiate a WebSocket push update of another component in onConfigure/onBeforeRender (maybe others)
> - Exception at the end of ajax request (WebSocket request finishes without problem)
> Long:
> AbstractAjaxResponse iterates all components to update in writeComponents(Response, String). 
> For each component writeComponent(Response, String, Component, String) is called in sub class XmlAjaxResponse which calls writeHeaderContribution(Response, Component) of AbstractAjaxResponse.
> This method creates the HtmlHeaderContainer and adds is to the page when rendering of first component added to target starts.
> Second component rendering (onConfigure/onBeforeRender) send a component update via websocket push to the client.
> The websocket request replaces the HtmlHeaderContainer added to the page and at the end of the AbstractAjaxResponse.writeTo(Response, String) to header is again replaced with a default one.
> But this default header is removed on MarkupContainer.detachChildren() method.
> Now the ajax request is "continued" and writeHeaderContribution is called for the second component.
> header is not null in writeHeaderContribution because it was already created when processing the first component, so the header is not added to the page again (remember it was replaced while websocket request).
> Now at the end of writeTo method, wicket tries again to replace the header with a default one (comment there says "restore normal header").
> This leads to an exception: Cannot replace a component which has not been added: id='_header_'.... 
> A little notice:
> The error would not happen, if second component would be processed before first component, because then the HeaderContainerItem of the ajax request isn't craeted before the websocket request is finished and so the header is added to the page on creation. So the problem is the removal of the HeaderContainerItem in detachChildren() after websocket request.
> In Wicket 7.4 (the only one i tested, this works without problems)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)