@Override public synchronized void setAttribute(String name, Object value) { checkManagedAttribute(name,value); Object old_value = super.getAttribute(name); if (value == null) super.removeAttribute(name); else super.setAttribute(name,value); if (!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value == null?value:old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) { if (old_value == null) l.attributeAdded(event); else if (value == null) l.attributeRemoved(event); else l.attributeReplaced(event); } } }
@Override public synchronized void setAttribute(String name, Object value) { checkManagedAttribute(name,value); Object old_value = super.getAttribute(name); if (value == null) super.removeAttribute(name); else super.setAttribute(name,value); if (!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value == null?value:old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) { if (old_value == null) l.attributeAdded(event); else if (value == null) l.attributeRemoved(event); else l.attributeReplaced(event); } } }
@Override public synchronized void setAttribute(String name, Object value) { checkManagedAttribute(name,value); Object old_value = super.getAttribute(name); if (value == null) super.removeAttribute(name); else super.setAttribute(name,value); if (!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value == null?value:old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) { if (old_value == null) l.attributeAdded(event); else if (value == null) l.attributeRemoved(event); else l.attributeReplaced(event); } } }