Class MetricsServlet.ContextListener
java.lang.Object
com.codahale.metrics.servlets.MetricsServlet.ContextListener
- All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener
- Enclosing class:
MetricsServlet
public abstract static class MetricsServlet.ContextListener
extends Object
implements javax.servlet.ServletContextListener
An abstract
ServletContextListener which allows you to programmatically inject the
MetricRegistry, rate and duration units, and allowed origin for
MetricsServlet.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextDestroyed(javax.servlet.ServletContextEvent event) voidcontextInitialized(javax.servlet.ServletContextEvent event) protected StringReturns theAccess-Control-Allow-Originheader value, if any.protected TimeUnitReturns theTimeUnitto which durations should be converted, ornullif the default should be used.protected abstract MetricRegistryReturns theMetricRegistryto inject into the servlet context.protected TimeUnitReturns theTimeUnitto which rates should be converted, ornullif the default should be used.
-
Constructor Details
-
ContextListener
public ContextListener()
-
-
Method Details
-
getMetricRegistry
Returns theMetricRegistryto inject into the servlet context. -
getRateUnit
-
getDurationUnit
-
getAllowedOrigin
Returns theAccess-Control-Allow-Originheader value, if any. -
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event) - Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent event) - Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener
-