当前位置: 首页>>代码示例>>Java>>正文


Java ServletContextAttributeEvent类代码示例

本文整理汇总了Java中javax.servlet.ServletContextAttributeEvent的典型用法代码示例。如果您正苦于以下问题:Java ServletContextAttributeEvent类的具体用法?Java ServletContextAttributeEvent怎么用?Java ServletContextAttributeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServletContextAttributeEvent类属于javax.servlet包,在下文中一共展示了ServletContextAttributeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attributeAdded

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
@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);
			}
		}
	}
}
 
开发者ID:HsingPeng,项目名称:ALLGO,代码行数:20,代码来源:ActionListener.java

示例2: attributeAdded

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
@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()));
    }

}
 
开发者ID:venusdrogon,项目名称:feilong-servlet,代码行数:20,代码来源:ServletContextAttributeLoggingListener.java

示例3: removeAttribute

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:ServletContextImpl.java

示例4: attributeRemoved

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
public void attributeRemoved(ServletContextAttributeEvent ev)
{
    if (ev.getName().equals(ContainerUtil.ATTRIBUTE_CONTAINER_LIST))
    {
        List containers = (List) ev.getValue();
        ContainerUtil.shutdownServerLoadMonitorsInContainerList(containers, "EfficientShutdownServletContextAttributeListener");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:EfficientShutdownServletContextAttributeListener.java

示例5: attributeAdded

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
/**
 * 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() + "')");

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:13,代码来源:ContextListener.java

示例6: attributeRemoved

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
/**
 * 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() + "')");

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:13,代码来源:ContextListener.java

示例7: attributeReplaced

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
/**
 * 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() + "')");

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:13,代码来源:ContextListener.java

示例8: removeAttribute

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
/**
 * 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);
		}
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:44,代码来源:ApplicationContext.java

示例9: attributeAdded

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
public void attributeAdded(ServletContextAttributeEvent scab)
{
    if (scab.getName().equals(Bayeux.DOJOX_COMETD_BAYEUX))
    {
        Bayeux bayeux=(Bayeux)scab.getValue();
        initialize(bayeux);
    }
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:9,代码来源:BayeuxServicesListener.java

示例10: setAttribute

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
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);
  }
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:14,代码来源:WebAppContextImpl.java

示例11: removeAttribute

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
public void removeAttribute(String name) {
  Object oldValue = attributes.remove(name);
  if (oldValue != null) {
    ServletContextAttributeEvent event = createEvent(name, oldValue);
    webapp.getGlobalServletContextAttributeListener().attributeRemoved(event);
  }
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:WebAppContextImpl.java

示例12: attributeAdded

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
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>" );
        }
    }
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:9,代码来源:SCAttributeEventListener.java

示例13: attributeRemoved

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
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>" );
    }
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:SCAttributeEventListener.java

示例14: attributeReplaced

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
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>" );
    }
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:SCAttributeEventListener.java

示例15: attributeReplaced

import javax.servlet.ServletContextAttributeEvent; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:11,代码来源:NumNamesListenerSoln.java


注:本文中的javax.servlet.ServletContextAttributeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。