Java 类javax.servlet.ServletContextAttributeEvent 实例源码

项目:feilong-servlet    文件:ServletContextAttributeLoggingListener.java   
@Override
public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent){
    if (LOGGER.isInfoEnabled()){
        String name = servletContextAttributeEvent.getName();

        if (isNotNullOrEmpty(name) && ArrayUtils.contains(ServletContextUtil.EXCLUDE_KEYS, name)){
            return;
        }

        //---------------------------------------------------------------

        LOGGER.info(
                        "name:[{}],value:[{}] added to [servletContext],now servletContext attribute:[{}] ",
                        name,
                        servletContextAttributeEvent.getValue(),
                        buildAttributesLogMessage(servletContextAttributeEvent.getServletContext()));
    }

}
项目:ALLGO    文件:ActionListener.java   
@SuppressWarnings("unchecked")
@Override
public void attributeAdded(ServletContextAttributeEvent arg0) {
    if(userMap == null){
        userMap = (Map<Integer, WsOutbound>) arg0.getServletContext().getAttribute("OnLineList");
    }
    //System.out.println("listener==>attributeAdded");
    Enumeration<String> att = arg0.getServletContext().getAttributeNames();
    while(att.hasMoreElements()){
        String next = att.nextElement();
        if(next.startsWith("action")){
                ServerMsg message = (ServerMsg) arg0.getServletContext().getAttribute(next);
            if(message != null){
            arg0.getServletContext().removeAttribute(next);
            doAction(message);
            }
        }
    }
}
项目:opennmszh    文件:ServletContextImpl.java   
@Override
public void removeAttribute(String name)
{
    Object oldValue;
    if (this.attributes != null)
    {
        oldValue = this.attributes.remove(name);
    }
    else
    {
        oldValue = this.context.getAttribute(name);
        this.context.removeAttribute(name);
    }

    if (oldValue != null)
    {
        attributeListener.attributeRemoved(new ServletContextAttributeEvent(this, name, oldValue));
    }
}
项目:parabuild-ci    文件:EfficientShutdownServletContextAttributeListener.java   
public void attributeRemoved(ServletContextAttributeEvent ev)
{
    if (ev.getName().equals(ContainerUtil.ATTRIBUTE_CONTAINER_LIST))
    {
        List containers = (List) ev.getValue();
        ContainerUtil.shutdownServerLoadMonitorsInContainerList(containers, "EfficientShutdownServletContextAttributeListener");
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.73-with-comment    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:lazycat    文件:ApplicationContext.java   
/**
 * Remove the context attribute with the specified name, if any.
 *
 * @param name
 *            Name of the context attribute to be removed
 */
@Override
public void removeAttribute(String name) {

    Object value = null;

    // Remove the specified attribute
    // Check for read only attribute
    if (readOnlyAttributes.containsKey(name)) {
        return;
    }
    value = attributes.remove(name);
    if (value == null) {
        return;
    }

    // Notify interested application event listeners
    Object listeners[] = context.getApplicationEventListeners();
    if ((listeners == null) || (listeners.length == 0))
        return;
    ServletContextAttributeEvent event = new ServletContextAttributeEvent(context.getServletContext(), name, value);
    for (int i = 0; i < listeners.length; i++) {
        if (!(listeners[i] instanceof ServletContextAttributeListener))
            continue;
        ServletContextAttributeListener listener = (ServletContextAttributeListener) listeners[i];
        try {
            context.fireContainerEvent("beforeContextAttributeRemoved", listener);
            listener.attributeRemoved(event);
            context.fireContainerEvent("afterContextAttributeRemoved", listener);
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            context.fireContainerEvent("afterContextAttributeRemoved", listener);
            // FIXME - should we do anything besides log these?
            log(sm.getString("applicationContext.attributeEvent"), t);
        }
    }

}
项目:openbravo-pos    文件:BayeuxServicesListener.java   
public void attributeAdded(ServletContextAttributeEvent scab)
{
    if (scab.getName().equals(Bayeux.DOJOX_COMETD_BAYEUX))
    {
        Bayeux bayeux=(Bayeux)scab.getValue();
        initialize(bayeux);
    }
}
项目:opengse    文件:WebAppContextImpl.java   
public void setAttribute(String name, Object object) {
  Object previousValue = attributes.put(name, object);
  ServletContextAttributeEvent event;
  if (previousValue != null) {
    event = createEvent(name, previousValue);
    webapp.getGlobalServletContextAttributeListener()
        .attributeReplaced(event);
  } else {
    event = createEvent(name, object);
    webapp.getGlobalServletContextAttributeListener()
        .attributeAdded(event);
  }
}
项目:opengse    文件:WebAppContextImpl.java   
public void removeAttribute(String name) {
  Object oldValue = attributes.remove(name);
  if (oldValue != null) {
    ServletContextAttributeEvent event = createEvent(name, oldValue);
    webapp.getGlobalServletContextAttributeListener().attributeRemoved(event);
  }
}
项目:opengse    文件:SCAttributeEventListener.java   
public void attributeAdded( ServletContextAttributeEvent event ) {

        if ( event.getName().indexOf( SC_ATTRIBUTE ) > -1 ) {
            sl.writeToLog( "In AttributeAdded() method of SCAttributeEventListener<BR>" );
            sl.writeToLog( "Attribute added for Event Name=" + event.getName() + "<BR>" );
            sl.writeToLog( "Attribute added for Event value=" + event.getValue() + "<BR>" );
        }
    }
项目:opengse    文件:SCAttributeEventListener.java   
public void attributeRemoved( ServletContextAttributeEvent event ) {
    if ( event.getName().indexOf( SC_ATTRIBUTE ) > -1 ) {
        sl.writeToLog( "In AttributeRemoved() method of SCAttributeEventListener<BR>" );
        sl.writeToLog( "Attribute removed for Event Name=" + event.getName() + "<BR>" );
        sl.writeToLog( "Attribute removed for Event value=" + event.getValue() + "<BR>" );
    }
}
项目:opengse    文件:SCAttributeEventListener.java   
public void attributeReplaced( ServletContextAttributeEvent event ) {
    if ( event.getName().indexOf( SC_ATTRIBUTE ) > -1 ) {
        sl.writeToLog( "In AttributeReplaced() method of SCAttributeEventListener<BR>" );
        sl.writeToLog( "Attribute replaced for Event Name=" + event.getName() + "<BR>" );
        sl.writeToLog( "Attribute replaced for Event value=" + event.getValue() + "<BR>" );
    }
}
项目:CS416F16CourseInfo    文件:NumNamesListenerSoln.java   
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {
    if (event.getName().equals("numNamesSoln")) {
        long curTime = System.nanoTime();
        long lastTime = ((Long)event.getServletContext().getAttribute("timeLastChange")).longValue();
        long timeSinceChange = curTime - lastTime;
        event.getServletContext().log("Time since numNamesSoln changed: "+timeSinceChange);
        event.getServletContext().setAttribute("timeLastChange", new Long(curTime));
    }
}
项目:winstone    文件:WebAppConfiguration.java   
@Override
public void removeAttribute(final String name) {
    final Object me = attributes.get(name);
    attributes.remove(name);
    if (me != null) {
        for (int n = 0; n < contextAttributeListeners.length; n++) {
            final ClassLoader cl = Thread.currentThread().getContextClassLoader();
            Thread.currentThread().setContextClassLoader(getLoader());
            contextAttributeListeners[n].attributeRemoved(new ServletContextAttributeEvent(this, name, me));
            Thread.currentThread().setContextClassLoader(cl);
        }
    }
}
项目:feilong-servlet    文件:ServletContextAttributeLoggingListener.java   
@Override
public void attributeRemoved(ServletContextAttributeEvent servletContextAttributeEvent){
    if (LOGGER.isInfoEnabled()){
        LOGGER.info(
                        "name:[{}],value:[{}] removed from [servletContext],now servletContext attribute:[{}] ",
                        servletContextAttributeEvent.getName(),
                        servletContextAttributeEvent.getValue(),
                        buildAttributesLogMessage(servletContextAttributeEvent.getServletContext()));

    }
}
项目:feilong-servlet    文件:ServletContextAttributeLoggingListener.java   
@Override
public void attributeReplaced(ServletContextAttributeEvent servletContextAttributeEvent){
    if (LOGGER.isInfoEnabled()){
        LOGGER.info(
                        "name:[{}],value:[{}] replaced to [servletContext],now servletContext attribute:[{}] ",
                        servletContextAttributeEvent.getName(),
                        servletContextAttributeEvent.getValue(),
                        buildAttributesLogMessage(servletContextAttributeEvent.getServletContext()));
    }
}
项目:osgi.ee    文件:OurServletContext.java   
@Override
public void setAttribute(String attr, Object value) {
    Object original = attributes.get(attr);
    attributes.put(attr, value);
    ServletContextAttributeEvent event = new ServletContextAttributeEvent(this, attr, value);
    if (original != null) {
        call(ServletContextAttributeListener.class, (l) -> l.attributeReplaced(event));
    }
    else {
        call(ServletContextAttributeListener.class, (l) -> l.attributeAdded(event));
    }
}
项目:class-guard    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:class-guard    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:class-guard    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:apache-tomcat-7.0.57    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:opennmszh    文件:ServletContextAttributeListenerManager.java   
@Override
public void attributeAdded(final ServletContextAttributeEvent scab)
{
    final Iterator<ServletContextAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeAdded(scab);
    }
}
项目:opennmszh    文件:ServletContextAttributeListenerManager.java   
@Override
public void attributeRemoved(final ServletContextAttributeEvent scab)
{
    final Iterator<ServletContextAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeRemoved(scab);
    }
}
项目:opennmszh    文件:ServletContextAttributeListenerManager.java   
@Override
public void attributeReplaced(final ServletContextAttributeEvent scab)
{
    final Iterator<ServletContextAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeReplaced(scab);
    }
}
项目:opennmszh    文件:ServletContextImpl.java   
@Override
public void setAttribute(String name, Object value)
{
    if (value == null)
    {
        this.removeAttribute(name);
    }
    else if (name != null)
    {
        Object oldValue;
        if (this.attributes != null)
        {
            oldValue = this.attributes.put(name, value);
        }
        else
        {
            oldValue = this.context.getAttribute(name);
            this.context.setAttribute(name, value);
        }

        if (oldValue == null)
        {
            attributeListener.attributeAdded(new ServletContextAttributeEvent(this, name, value));
        }
        else
        {
            attributeListener.attributeReplaced(new ServletContextAttributeEvent(this, name, oldValue));
        }
    }
}
项目:OpenbravoPOS    文件:BayeuxServicesListener.java   
public void attributeAdded(ServletContextAttributeEvent scab)
{
    if (scab.getName().equals(Bayeux.DOJOX_COMETD_BAYEUX))
    {
        Bayeux bayeux=(Bayeux)scab.getValue();
        initialize(bayeux);
    }
}
项目:WBSAirback    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:WBSAirback    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {

    log("attributeRemoved('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:WBSAirback    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {

    log("attributeReplaced('" + event.getName() + "', '" +
            event.getValue() + "')");

}
项目:WBSAirback    文件:ContextListener.java   
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The servlet context attribute event
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {

    log("attributeAdded('" + event.getName() + "', '" +
            event.getValue() + "')");

}