etm.contrib.integration.web
Class EtmMonitorContextListener
java.lang.Object
etm.contrib.integration.web.EtmMonitorContextListener
- All Implemented Interfaces:
- java.util.EventListener, javax.servlet.ServletContextListener
public class EtmMonitorContextListener
- extends java.lang.Object
- implements javax.servlet.ServletContextListener
The EtmMonitorContextListener configures and starts an EtmMonitor using
an XmlEtmConfigurator. By default it assumes a file called
jetm-config.xml in classpath. You enable performance monitoring
by adding this code fragement to your web.xml file.
<listener>
<listener-class>etm.contrib.integration.web.EtmMonitorContextListener</listener-class>
</listener>
It is possible to override the name of the file using the web app init parameter
jetm.config.filename. Example:
<context-param>
<param-name>jetm.config.filename</param-name>
<param-value>custom-config.xml</param-value>
</context-param>
As an alternative the jetm config file may be loaded from file system. This feature can be enabled
by specifying jetm.config.filepath as context parameter. In the example below
the jetm config file is expected at /etc/yourapp under the name supplied with
jetm.config.filename. If jetm.config.filename is unset, the default name jetm-config.xml
will be used.
<context-param>
<param-name>jetm.config.filepath</param-name>
<param-value>/etc/yourapp</param-value>
</context-param>
While this feaure sounds convinient a hard coded filepath within a web.xml descriptor is often considered
a design or programming error. Therefore the path to a jetm config file can be specified using
a system property. Just write jetm.config.filepath as ant style property and its
value will be retrieved from System.getProperty(String) using the given name. Example:
<context-param>
<param-name>jetm.config.filepath</param-name>
<param-value>${myapp.jetm.path}</param-value>
</context-param>
- Version:
- $Revision: 246 $
- Author:
- void.fm
|
Method Summary |
void |
contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
|
void |
contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EtmMonitorContextListener
public EtmMonitorContextListener()
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
- Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
- Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Copyright © 2004,2005, 2006, 2007 void.fm. All Rights Reserved.