_servletContext=context==null?new ContextHandler.NoContext():context; _contextHandler=(ServletContextHandler)(context==null?null:context.getContextHandler());
@Override public synchronized Enumeration<String> getAttributeNames() { HashSet<String> set = new HashSet<String>(); Enumeration<String> e = super.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); e = _attributes.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); return Collections.enumeration(set); }
_servletContext=context==null?new ContextHandler.NoContext():context; _contextHandler=(ServletContextHandler)(context==null?null:context.getContextHandler());
_servletContext=context==null?new ContextHandler.NoContext():context; _contextHandler=(ServletContextHandler)(context==null?null:context.getContextHandler());
@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); } } }
@Override public synchronized void removeAttribute(String name) { checkManagedAttribute(name,null); Object old_value = super.getAttribute(name); super.removeAttribute(name); if (old_value != null &&!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) l.attributeRemoved(event); } }
@Override public synchronized void removeAttribute(String name) { checkManagedAttribute(name,null); Object old_value = super.getAttribute(name); super.removeAttribute(name); if (old_value != null &&!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) l.attributeRemoved(event); } }
@Override public synchronized void removeAttribute(String name) { checkManagedAttribute(name,null); Object old_value = super.getAttribute(name); super.removeAttribute(name); if (old_value != null &&!_contextAttributeListeners.isEmpty()) { ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value); for (ServletContextAttributeListener l : _contextAttributeListeners) l.attributeRemoved(event); } }
@Override public synchronized Object getAttribute(String name) { Object o = ContextHandler.this.getAttribute(name); if (o == null) o = super.getAttribute(name); return o; }
@Override public synchronized Enumeration<String> getAttributeNames() { HashSet<String> set = new HashSet<String>(); Enumeration<String> e = super.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); e = _attributes.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); return Collections.enumeration(set); }
@Override public synchronized Object getAttribute(String name) { Object o = ContextHandler.this.getAttribute(name); if (o == null) o = super.getAttribute(name); return o; }
@Override public synchronized Enumeration<String> getAttributeNames() { HashSet<String> set = new HashSet<String>(); Enumeration<String> e = super.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); e = _attributes.getAttributeNames(); while (e.hasMoreElements()) set.add(e.nextElement()); return Collections.enumeration(set); }
@Override public ServletContext getServletContext() { return new ContextHandler.NoContext(); }}); }
@Override public synchronized Object getAttribute(String name) { Object o = ContextHandler.this.getAttribute(name); if (o == null) o = super.getAttribute(name); return o; }