Package com.codahale.metrics.servlets
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 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 StringgetAllowedOrigin()protected TimeUnitgetDurationUnit()protected StringgetJsonpCallbackParameter()Returns the name of the parameter used to specify the jsonp callback, if any.protected com.codahale.metrics.MetricFiltergetMetricFilter()Returns theMetricFilterthat shall be used to filter metrics, orMetricFilter.ALLif the default should be used.protected abstract com.codahale.metrics.MetricRegistrygetMetricRegistry()protected TimeUnitgetRateUnit()
-
-
-
Method Detail
-
getMetricRegistry
protected abstract com.codahale.metrics.MetricRegistry getMetricRegistry()
- Returns:
- the
MetricRegistryto inject into the servlet context.
-
getRateUnit
protected TimeUnit getRateUnit()
- Returns:
- the
TimeUnitto which rates should be converted, ornullif the default should be used.
-
getDurationUnit
protected TimeUnit getDurationUnit()
- Returns:
- the
TimeUnitto which durations should be converted, ornullif the default should be used.
-
getAllowedOrigin
protected String getAllowedOrigin()
- Returns:
- the
Access-Control-Allow-Originheader value, if any.
-
getJsonpCallbackParameter
protected String getJsonpCallbackParameter()
Returns the name of the parameter used to specify the jsonp callback, if any.
-
getMetricFilter
protected com.codahale.metrics.MetricFilter getMetricFilter()
Returns theMetricFilterthat shall be used to filter metrics, orMetricFilter.ALLif the default should be used.
-
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
-
-