类javax.servlet.ServletContextAttributeEvent源码实例Demo

下面列出了怎么用javax.servlet.ServletContextAttributeEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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);
			}
		}
	}
}
 
源代码2 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码3 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码4 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码5 项目: Tomcat8-Source-Read   文件: ApplicationContext.java
@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 (Object obj : listeners) {
        if (!(obj instanceof ServletContextAttributeListener)) {
            continue;
        }
        ServletContextAttributeListener listener = (ServletContextAttributeListener) obj;
        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);
        }
    }
}
 
源代码6 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码7 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码8 项目: Tomcat8-Source-Read   文件: 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() + "')");

}
 
源代码9 项目: quarkus-http   文件: ApplicationListeners.java
public void servletContextAttributeAdded(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeAdded(sre);
    }
}
 
源代码10 项目: quarkus-http   文件: ApplicationListeners.java
public void servletContextAttributeRemoved(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeRemoved(sre);
    }
}
 
源代码11 项目: quarkus-http   文件: ApplicationListeners.java
public void servletContextAttributeReplaced(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeReplaced(sre);
    }
}
 
/**
 * Handle attribute added event.
 *
 * @param event the event.
 */
@Override
public void attributeAdded(ServletContextAttributeEvent event) {
    if (event.getName().equals("attributeAdded")) {
        event.getServletContext().setAttribute("attributeAdded2", true);
    }
}
 
/**
 * Handle attribute removed event.
 *
 * @param event the event.
 */
@Override
public void attributeRemoved(ServletContextAttributeEvent event) {
    if (event.getName().equals("attributeRemoved")) {
        event.getServletContext().setAttribute("attributeRemoved2", true);
    }
}
 
/**
 * Handle attribute replaced event.
 *
 * @param event the event.
 */
@Override
public void attributeReplaced(ServletContextAttributeEvent event) {
    if (event.getName().equals("attributeReplaced")) {
        event.getServletContext().setAttribute("attributeReplaced2", true);
    }
}
 
源代码15 项目: lams   文件: ApplicationListeners.java
public void servletContextAttributeAdded(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeAdded(sre);
    }
}
 
源代码16 项目: lams   文件: ApplicationListeners.java
public void servletContextAttributeRemoved(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeRemoved(sre);
    }
}
 
源代码17 项目: lams   文件: ApplicationListeners.java
public void servletContextAttributeReplaced(final String name, final Object value) {
    if(!started) {
        return;
    }
    final ServletContextAttributeEvent sre = new ServletContextAttributeEvent(servletContext, name, value);
    for (int i = 0; i < servletContextAttributeListeners.length; ++i) {
        this.<ServletContextAttributeListener>get(servletContextAttributeListeners[i]).attributeReplaced(sre);
    }
}
 
源代码18 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码19 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码20 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码21 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码22 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码23 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码24 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码25 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码26 项目: tomcatsrc   文件: 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() + "')");

}
 
源代码27 项目: quarkus-http   文件: ServletContextTestListener.java
@Override
public void attributeAdded(final ServletContextAttributeEvent event) {
    servletContextAttributeEvent = event;
}
 
源代码28 项目: quarkus-http   文件: ServletContextTestListener.java
@Override
public void attributeRemoved(final ServletContextAttributeEvent event) {
    servletContextAttributeEvent = event;
}
 
源代码29 项目: quarkus-http   文件: ServletContextTestListener.java
@Override
public void attributeReplaced(final ServletContextAttributeEvent event) {
    servletContextAttributeEvent = event;
}
 
源代码30 项目: quarkus-http   文件: TestSci.java
@Override
public void attributeAdded(ServletContextAttributeEvent event) {
    DEQUE.add("dl add " + event.getName());
}
 
 类所在包
 同包方法