This is no longer true. All request targets that deal with page call
page.detach, and the page is detached before serialization, even
during ajax requests.

Trigerring detachment of serialization is imho not a very good idea,
as it wouldn't work for httpsessionstore. And right now, it's not even
necessary, as the request targets do that.

Also in 1.x, each component's detach should be called only once,
because the only place where page.detach is (should in worst case :))
called is RequestTarget.detach

-Matej

On 3/26/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
On 3/26/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
> The onDetach sematics would be defined something like this:
> The method is called on the end of request, even if the component was
> not attached.
> The detach methods are usually rather simple, so I really don't think
> there would be a big performance penalty, as we already need to
> traverse the component tree.

If we can make it so that they are only called just once per request I
think it would be an improvement.

I think this is the right thing to do: the following case is quite typical:

public MyPage extends Page {
    IModel someModel;
    /* ... */
    void onDetach() {
        someModel.detach();
    }
}

Now if some model is attached during an Ajax request, I remember that
the ondetach of the page is not called (at least not some time ago),
causing serialization errors.

Hmm. Thinking of this... can't we trigger detachment on serialization?
We already go through the component tree there...

Martijn

--
Learn Wicket at ApacheCon Europe: http://apachecon.com
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.5 will keep your server alive. Download Wicket now!
http://wicketframework.org

Reply via email to