Package com.codahale.metrics.servlets
Class MetricsServlet.ContextListener
- java.lang.Object
-
- com.codahale.metrics.servlets.MetricsServlet.ContextListener
-
- All Implemented Interfaces:
java.util.EventListener,javax.servlet.ServletContextListener
- Enclosing class:
- MetricsServlet
public abstract static class MetricsServlet.ContextListener extends java.lang.Object implements javax.servlet.ServletContextListenerAn abstractServletContextListenerwhich allows you to programmatically inject theMetricRegistry, rate and duration units, and allowed origin forMetricsServlet.
-
-
Constructor Summary
Constructors Constructor Description ContextListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(javax.servlet.ServletContextEvent event)voidcontextInitialized(javax.servlet.ServletContextEvent event)protected java.lang.StringgetAllowedOrigin()Returns theAccess-Control-Allow-Originheader value, if any.protected java.util.concurrent.TimeUnitgetDurationUnit()Returns theTimeUnitto which durations should be converted, ornullif the default should be used.protected abstract MetricRegistrygetMetricRegistry()Returns theMetricRegistryto inject into the servlet context.protected java.util.concurrent.TimeUnitgetRateUnit()Returns theTimeUnitto which rates should be converted, ornullif the default should be used.
-
-
-
Method Detail
-
getMetricRegistry
protected abstract MetricRegistry getMetricRegistry()
Returns theMetricRegistryto inject into the servlet context.
-
getRateUnit
protected java.util.concurrent.TimeUnit getRateUnit()
Returns theTimeUnitto which rates should be converted, ornullif the default should be used.
-
getDurationUnit
protected java.util.concurrent.TimeUnit getDurationUnit()
Returns theTimeUnitto which durations should be converted, ornullif the default should be used.
-
getAllowedOrigin
protected java.lang.String 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
-
-