@Override public void contextDestroyed(ServletContextEvent event) { if (_destroyer != null) { ServletContext ctx = event.getServletContext(); Enumeration<String> attributes = ctx.getAttributeNames(); if (!attributes.hasMoreElements()) { // nothing to do return; } while (attributes.hasMoreElements()) { String name = attributes.nextElement(); Object value = ctx.getAttribute(name); _destroyer.destroy(name, value); } } }
/** * Destroys the given managed bean. * @param name * @param instance */ public void destroy(String name, Object instance) { if (instance != null && isManagedBean(name)) { try { _lifecycleProvider.destroyInstance(instance); } catch (IllegalAccessException e) { log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e); } catch (InvocationTargetException e) { log.log(Level.SEVERE, "An Exception occured while invoking " + "@PreDestroy method of managed bean " + name, e); } } }
protected ManagedBeanDestroyer getManagedBeanDestroyer(ExternalContext externalContext) { if (_mbDestroyer == null) { RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext); LifecycleProvider lifecycleProvider = LifecycleProviderFactory .getLifecycleProviderFactory(externalContext).getLifecycleProvider(externalContext); _mbDestroyer = new ManagedBeanDestroyer(lifecycleProvider, runtimeConfig); } return _mbDestroyer; } }
protected static ManagedBeanDestroyer getManagedBeanDestroyer(ExternalContext externalContext) { RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext); LifecycleProvider lifecycleProvider = LifecycleProviderFactory .getLifecycleProviderFactory(externalContext).getLifecycleProvider(externalContext); return new ManagedBeanDestroyer(lifecycleProvider, runtimeConfig); } }
@SuppressWarnings("unchecked") public void contextDestroyed(ServletContextEvent event) { if (_destroyer != null) { ServletContext ctx = event.getServletContext(); Enumeration<String> attributes = ctx.getAttributeNames(); if (!attributes.hasMoreElements()) { // nothing to do return; } while (attributes.hasMoreElements()) { String name = attributes.nextElement(); Object value = ctx.getAttribute(name); _destroyer.destroy(name, value); } } }
= new ManagedBeanDestroyer(lifecycleProvider, runtimeConfig);
/** * Destroys the given managed bean. * @param name * @param instance */ public void destroy(String name, Object instance) { if (instance != null && isManagedBean(name)) { try { _lifecycleProvider.destroyInstance(instance); } catch (IllegalAccessException e) { log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e); } catch (InvocationTargetException e) { log.log(Level.SEVERE, "An Exception occured while invoking " + "@PreDestroy method of managed bean " + name, e); } } }
@SuppressWarnings("unchecked") public void contextDestroyed(ServletContextEvent event) { if (_destroyer != null) { ServletContext ctx = event.getServletContext(); Enumeration<String> attributes = ctx.getAttributeNames(); if (!attributes.hasMoreElements()) { // nothing to do return; } while (attributes.hasMoreElements()) { String name = attributes.nextElement(); Object value = ctx.getAttribute(name); _destroyer.destroy(name, value); } } }
= new ManagedBeanDestroyer(lifecycleProvider, runtimeConfig);
/** * Destroys the given managed bean. * @param name * @param instance */ public void destroy(String name, Object instance) { if (instance != null && isManagedBean(name)) { try { _lifecycleProvider.destroyInstance(instance); } catch (IllegalAccessException e) { log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e); } catch (InvocationTargetException e) { log.log(Level.SEVERE, "An Exception occured while invoking " + "@PreDestroy method of managed bean " + name, e); } } }
@Override public void attributeReplaced(ServletContextAttributeEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
= new ManagedBeanDestroyer(lifecycleProvider, runtimeConfig);
public void attributeReplaced(ServletContextAttributeEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
@Override public void destroyViewScopeMap(FacesContext facesContext, String viewScopeId) { if (facesContext.getExternalContext().getSession(false) != null) { String fullToken = VIEW_SCOPE_PREFIX_MAP + SEPARATOR_CHAR + viewScopeId + SEPARATOR_CHAR; Map<String, Object> map = _createSubKeyMap(facesContext, fullToken); ManagedBeanDestroyer mbDestroyer = getManagedBeanDestroyer(facesContext.getExternalContext()); for (Map.Entry<String,Object> entry : map.entrySet()) { mbDestroyer.destroy(entry.getKey(), entry.getValue()); } map.clear(); } }
@Override public void requestDestroyed(ServletRequestEvent event) { if (_destroyer != null) { ServletRequest request = event.getServletRequest(); Enumeration<String> attributes = request.getAttributeNames(); if (!attributes.hasMoreElements()) { // nothing to do return; } while (attributes.hasMoreElements()) { String name = attributes.nextElement(); Object value = request.getAttribute(name); _destroyer.destroy(name, value); } } }
public void attributeRemoved(HttpSessionBindingEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
public void attributeReplaced(HttpSessionBindingEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
public void attributeReplaced(ServletRequestAttributeEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
public void attributeRemoved(ServletRequestAttributeEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }
public void attributeReplaced(ServletRequestAttributeEvent event) { if (_destroyer != null) { _destroyer.destroy(event.getName(), event.getValue()); } }