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 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 TypeMethodDescriptionvoid
contextDestroyed
(javax.servlet.ServletContextEvent event) void
contextInitialized
(javax.servlet.ServletContextEvent event) protected String
Returns theAccess-Control-Allow-Origin
header value, if any.protected TimeUnit
Returns theTimeUnit
to which durations should be converted, ornull
if the default should be used.protected abstract MetricRegistry
Returns theMetricRegistry
to inject into the servlet context.protected TimeUnit
Returns theTimeUnit
to which rates should be converted, ornull
if the default should be used.
-
Constructor Details
-
ContextListener
public ContextListener()
-
-
Method Details
-
getMetricRegistry
Returns theMetricRegistry
to inject into the servlet context. -
getRateUnit
Returns theTimeUnit
to which rates should be converted, ornull
if the default should be used. -
getDurationUnit
Returns theTimeUnit
to which durations should be converted, ornull
if the default should be used. -
getAllowedOrigin
Returns theAccess-Control-Allow-Origin
header value, if any. -
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event) - Specified by:
contextInitialized
in interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent event) - Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
-