Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

listeners
Class ContextListener  view ContextListener download ContextListener.java

java.lang.Object
  extended bylisteners.ContextListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletContextAttributeListener, javax.servlet.ServletContextListener

public final class ContextListener
extends java.lang.Object
implements javax.servlet.ServletContextAttributeListener, javax.servlet.ServletContextListener

Example listener for context-related application events, which were introduced in the 2.3 version of the Servlet API. This listener merely documents the occurrence of such events in the application log associated with our servlet context.

Version:
$Revision: 267129 $ $Date: 2004-03-18 11:40:35 -0500 (Thu, 18 Mar 2004) $

Field Summary
private  javax.servlet.ServletContext context
          The servlet context with which we are associated.
 
Constructor Summary
ContextListener()
           
 
Method Summary
 void attributeAdded(javax.servlet.ServletContextAttributeEvent event)
          Record the fact that a servlet context attribute was added.
 void attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
          Record the fact that a servlet context attribute was removed.
 void attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
          Record the fact that a servlet context attribute was replaced.
 void contextDestroyed(javax.servlet.ServletContextEvent event)
          Record the fact that this web application has been destroyed.
 void contextInitialized(javax.servlet.ServletContextEvent event)
          Record the fact that this web application has been initialized.
private  void log(java.lang.String message)
          Log a message to the servlet context application log.
private  void log(java.lang.String message, java.lang.Throwable throwable)
          Log a message and associated exception to the servlet context application log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private javax.servlet.ServletContext context
The servlet context with which we are associated.

Constructor Detail

ContextListener

public ContextListener()
Method Detail

attributeAdded

public void attributeAdded(javax.servlet.ServletContextAttributeEvent event)
Record the fact that a servlet context attribute was added.

Specified by:
attributeAdded in interface javax.servlet.ServletContextAttributeListener

attributeRemoved

public void attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
Record the fact that a servlet context attribute was removed.

Specified by:
attributeRemoved in interface javax.servlet.ServletContextAttributeListener

attributeReplaced

public void attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
Record the fact that a servlet context attribute was replaced.

Specified by:
attributeReplaced in interface javax.servlet.ServletContextAttributeListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent event)
Record the fact that this web application has been destroyed.

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent event)
Record the fact that this web application has been initialized.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

log

private void log(java.lang.String message)
Log a message to the servlet context application log.


log

private void log(java.lang.String message,
                 java.lang.Throwable throwable)
Log a message and associated exception to the servlet context application log.