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


Java ServletRequestAttributeEvent类代码示例

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


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

示例1: notifyAttributeRemoved

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
/**
 * Notify interested listeners that attribute has been removed.
 */
private void notifyAttributeRemoved(String name, Object value) {
    Object listeners[] = context.getApplicationEventListeners();
    if ((listeners == null) || (listeners.length == 0)) {
        return;
    }
    ServletRequestAttributeEvent event =
      new ServletRequestAttributeEvent(context.getServletContext(),
                                       getRequest(), name, value);
    for (int i = 0; i < listeners.length; i++) {
        if (!(listeners[i] instanceof ServletRequestAttributeListener)) {
            continue;
        }
        ServletRequestAttributeListener listener =
            (ServletRequestAttributeListener) listeners[i];
        try {
            listener.attributeRemoved(event);
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
            // Error valve will pick this exception up and display it to user
            attributes.put(RequestDispatcher.ERROR_EXCEPTION, t);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:Request.java

示例2: notifyAttributeRemoved

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
/**
 * Notify interested listeners that attribute has been removed.
 */
private void notifyAttributeRemoved(String name, Object value) {
	Object listeners[] = context.getApplicationEventListeners();
	if ((listeners == null) || (listeners.length == 0)) {
		return;
	}
	ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(),
			name, value);
	for (int i = 0; i < listeners.length; i++) {
		if (!(listeners[i] instanceof ServletRequestAttributeListener)) {
			continue;
		}
		ServletRequestAttributeListener listener = (ServletRequestAttributeListener) listeners[i];
		try {
			listener.attributeRemoved(event);
		} catch (Throwable t) {
			ExceptionUtils.handleThrowable(t);
			context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
			// Error valve will pick this exception up and display it to
			// user
			attributes.put(RequestDispatcher.ERROR_EXCEPTION, t);
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:Request.java

示例3: removeAttribute

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void removeAttribute(final String name) {
	final Object value = attributes.get(name);
	if (value == null) {
		return;
	}

	// fire event
	if (requestAttributeListeners != null) {
		for (int n = 0; n < requestAttributeListeners.length; n++) {
			final ClassLoader cl = Thread.currentThread().getContextClassLoader();
			Thread.currentThread().setContextClassLoader(getWebAppConfig().getLoader());
			requestAttributeListeners[n].attributeRemoved(new ServletRequestAttributeEvent(webappConfig, this, name, value));
			Thread.currentThread().setContextClassLoader(cl);
		}
	}

	attributes.remove(name);
}
 
开发者ID:geronimo-iia,项目名称:winstone,代码行数:20,代码来源:WinstoneRequest.java

示例4: setAttribute

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void setAttribute(String name, Object value)
{
    if (value == null)
    {
        this.removeAttribute(name);
    }
    else if (name != null)
    {
        Object oldValue = this.getAttribute(name);
        super.setAttribute(name, value);

        if (oldValue == null)
        {
            requestAttributeListener.attributeAdded(new ServletRequestAttributeEvent(servletContext, this,
                name, value));
        }
        else
        {
            requestAttributeListener.attributeReplaced(new ServletRequestAttributeEvent(servletContext, this,
                name, oldValue));
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:24,代码来源:DispatcherServlet.java

示例5: attributeAdded

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeAdded(ServletRequestAttributeEvent servletRequestAttributeEvent){
    if (LOGGER.isTraceEnabled()){
        LOGGER.trace(
                        "name:[{}],value:[{}] added to [servletRequest]",
                        servletRequestAttributeEvent.getName(),
                        servletRequestAttributeEvent.getValue());
    }
}
 
开发者ID:venusdrogon,项目名称:feilong-servlet,代码行数:10,代码来源:ServletRequestAttributeLoggingListener.java

示例6: attributeRemoved

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeRemoved(ServletRequestAttributeEvent servletRequestAttributeEvent){
    if (LOGGER.isDebugEnabled()){
        LOGGER.debug(
                        "name:[{}],value:[{}] removed from [servletRequest]",
                        servletRequestAttributeEvent.getName(),
                        servletRequestAttributeEvent.getValue());
    }
}
 
开发者ID:venusdrogon,项目名称:feilong-servlet,代码行数:10,代码来源:ServletRequestAttributeLoggingListener.java

示例7: attributeReplaced

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeReplaced(ServletRequestAttributeEvent servletRequestAttributeEvent){
    if (LOGGER.isTraceEnabled()){
        LOGGER.trace(
                        "name:[{}],value:[{}] replaced to [servletRequest]",
                        servletRequestAttributeEvent.getName(),
                        servletRequestAttributeEvent.getValue());
    }
}
 
开发者ID:venusdrogon,项目名称:feilong-servlet,代码行数:10,代码来源:ServletRequestAttributeLoggingListener.java

示例8: setAttribute

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void setAttribute(String name, Object value) {
    if (value == null) {
        this.removeAttribute(name);
    } else if (name != null) {
        Object oldValue = this.getAttribute(name);
        super.setAttribute(name, value);

        if (oldValue == null) {
            requestAttributeListener.attributeAdded(new ServletRequestAttributeEvent(servletContext, this, name, value));
        } else {
            requestAttributeListener.attributeReplaced(new ServletRequestAttributeEvent(servletContext, this, name, oldValue));
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:DispatcherFilter.java

示例9: removeAttribute

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void removeAttribute(String name) {
    Object oldValue = this.getAttribute(name);
    super.removeAttribute(name);

    if (oldValue != null) {
        requestAttributeListener.attributeRemoved(new ServletRequestAttributeEvent(servletContext, this, name, oldValue));
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:DispatcherFilter.java

示例10: attributeAdded

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeAdded(final ServletRequestAttributeEvent srae)
{
    final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeAdded(srae);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:ServletRequestAttributeListenerManager.java

示例11: attributeRemoved

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeRemoved(final ServletRequestAttributeEvent srae)
{
    final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeRemoved(srae);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:ServletRequestAttributeListenerManager.java

示例12: attributeReplaced

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeReplaced(final ServletRequestAttributeEvent srae)
{
    final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
    while (listeners.hasNext())
    {
        listeners.next().attributeReplaced(srae);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:ServletRequestAttributeListenerManager.java

示例13: removeAttribute

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void removeAttribute(String name)
{
    Object oldValue = this.getAttribute(name);
    super.removeAttribute(name);

    if (oldValue != null)
    {
        requestAttributeListener.attributeRemoved(new ServletRequestAttributeEvent(servletContext, this, name,
            oldValue));
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:DispatcherServlet.java

示例14: attributeAdded

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeAdded(ServletRequestAttributeEvent srae) {
	logger.info("MyServletRequestAttributeListener.attributeAdded: " + srae.getName());
	sampleServletRequestAttributeSet.add(1);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:6,代码来源:SampleServletRequestAttributeListener.java

示例15: attributeRemoved

import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeRemoved(ServletRequestAttributeEvent srae) {
	logger.info("MyServletRequestAttributeListener.attributeRemoved: " + srae.getName());
	sampleServletRequestAttributeSet.add(2);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:6,代码来源:SampleServletRequestAttributeListener.java


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