Gerhard, thanks for the quick response. I tried windowContext#close() and it works fine. I dug up this jira http://java.net/jira/browse/JAVASERVERFACES-1351 and it looks just like you said with viewscoped, so this is a limitation worth knowing about.
Gerhard Petracek wrote: > > hi brendan, > > in case of @javax.faces.bean.ViewScoped it looks like > javax.faces.event.PreDestroyViewMapEvent doesn't get fired. > in case of @ViewAccessScoped it's just not possible by definition to do it > autom. (before the session expires) if you redirect to an external page, > but you can use WindowContext#close (or #closeConversations) manually > before you do the redirect. > > regards, > gerhard > > http://www.irian.at > > Your JSF/JavaEE powerhouse - > JavaEE Consulting, Development and > Courses in English and German > > Professional Support for Apache MyFaces > > > > 2012/9/7 oversteer <[email protected]> > >> >> >> I have a simple page with a backing bean which redirects >> (FacesContext.getCurrentInstance().getExternalContext().redirect(target)) >> to >> an external website when a commandButton is pushed. >> >> I notice that when using @ViewAccessScoped or >> @javax.faces.bean.ViewScoped >> the predestroy method only runs at session expiration time. It's fine >> with >> @javax.enterprise.context.RequestScoped. >> >> Based on the contracts for @View*Scoped I'd expect the predestroy to run >> and >> the beans to be garbage collected, is this expected behavior or a memory >> leak? >> >> Regards, >> Brendan. >> >> p.s. I'm using JSF 2.1.12 & CODI 1.05 >> -- >> View this message in context: >> http://old.nabble.com/CODI-scoped-beans-%40PreDestroy-not-running-after-redirect-tp34402504p34402504.html >> Sent from the MyFaces - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://old.nabble.com/CODI-scoped-beans-%40PreDestroy-not-running-after-redirect-tp34402504p34403528.html Sent from the MyFaces - Users mailing list archive at Nabble.com.

