@ SuppressWarnings ( { "unchecked" , "rawtypes" , "unused" } ) public void afterPhase ( final PhaseEvent event ) { if ( PhaseId . RENDER_RESPONSE . equals ( event . getPhaseId ( ) ) ) { RenderContext contextInstance = getContextInstance ( ) ; if ( contextInstance != null ) { Integer id = contextInstance . getId ( ) ; RenderContext removed = getRenderContextMap ( ) . remove ( id ) ; Map < Contextual < ? > , Object > componentInstanceMap = getComponentInstanceMap ( ) ; Map < Contextual < ? > , CreationalContext < ? > > creationalContextMap = getCreationalContextMap ( ) ; if ( ( componentInstanceMap != null ) && ( creationalContextMap != null ) ) { for ( Entry < Contextual < ? > , Object > componentEntry : componentInstanceMap . entrySet ( ) ) { Contextual contextual = componentEntry . getKey ( ) ; Object instance = componentEntry . getValue ( ) ; CreationalContext creational = creationalContextMap . get ( contextual ) ; contextual . destroy ( instance , creational ) ; } } } } }
Destroy the current context since Render Response has completed .