Search in sources :

Example 6 with ServletRequestAttributeEvent

use of javax.servlet.ServletRequestAttributeEvent in project tomcat70 by apache.

the class Request method notifyAttributeRemoved.

/**
 * 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);
        }
    }
}
Also used : ServletRequestAttributeListener(javax.servlet.ServletRequestAttributeListener) ServletRequestAttributeEvent(javax.servlet.ServletRequestAttributeEvent)

Aggregations

ServletRequestAttributeEvent (javax.servlet.ServletRequestAttributeEvent)6 ServletRequestAttributeListener (javax.servlet.ServletRequestAttributeListener)5 File (java.io.File)1 IOException (java.io.IOException)1 AttributesMap (org.eclipse.jetty.util.AttributesMap)1