[
https://issues.apache.org/jira/browse/WICKET-3695?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-3695.
-----------------------------------
Resolution: Won't Fix
Assignee: Igor Vaynberg
for these kinds of usecases you can override requestcycle.ondetach () like
this:
{code}
super.ondetach();
for (IRequestCycleListener l:getListeners()) {
if (l instanceof MySpecialListener) {
((MySpecialListener)l).onDetached();
}
}
{code}
> No onAfterTargetsDetached (or similar) available in IRequestCycleListener
> -------------------------------------------------------------------------
>
> Key: WICKET-3695
> URL: https://issues.apache.org/jira/browse/WICKET-3695
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.5-RC4
> Reporter: Emond Papegaaij
> Assignee: Igor Vaynberg
>
> In Wicket 1.4, we used to override onAfterTargetsDetached to check if all
> models in our pages are fully detached. In onEndRequest we closed the
> hibernate session and destroyed several threadlocals. In
> IRequestCycleListener, onEndRequest has been moved to execute before
> onDetach, and nothing executes after detach. The order in Wicket 1.4 was
> detach, onAfterTargetsDetached, onEndRequest, in Wicket 1.5 it has become
> onEndRequest, onDetach. This gives no place to run code after the detach,
> whereas Wicket 1.4 provided 2 options. In my opinion, either a new method
> should be added (onRequestDestroyed?) or onEndRequest should be moved to
> execute after onDetach (which, to me, makes more sense).
> The current behavior makes it very difficult to work with request cycle
> listeners. For example, we can't close the hibernate session before pages are
> detached. Some of our models use the hibernate session during detach to
> record changes made to the objects stored in these models. This will fail if
> the hibernate session is already closed. Also, the detach-checker needs to
> run after the pages are detached. The only solutions for these problems I can
> think of right now is not to use request cycle listeners or to use a custom
> IRequestCycleProvider, which adds the listeners even before the wicket
> internal ones.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira