Class 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.ServletContextListener
    An abstract ServletContextListener which allows you to programmatically inject the MetricRegistry, rate and duration units, and allowed origin for MetricsServlet.
    • Constructor Summary

      Constructors 
      Constructor Description
      ContextListener()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void contextDestroyed​(javax.servlet.ServletContextEvent event)  
      void contextInitialized​(javax.servlet.ServletContextEvent event)  
      protected java.lang.String getAllowedOrigin()
      Returns the Access-Control-Allow-Origin header value, if any.
      protected java.util.concurrent.TimeUnit getDurationUnit()
      Returns the TimeUnit to which durations should be converted, or null if the default should be used.
      protected abstract MetricRegistry getMetricRegistry()
      Returns the MetricRegistry to inject into the servlet context.
      protected java.util.concurrent.TimeUnit getRateUnit()
      Returns the TimeUnit to which rates should be converted, or null if the default should be used.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ContextListener

        public ContextListener()
    • Method Detail

      • getRateUnit

        protected java.util.concurrent.TimeUnit getRateUnit()
        Returns the TimeUnit to which rates should be converted, or null if the default should be used.
      • getDurationUnit

        protected java.util.concurrent.TimeUnit getDurationUnit()
        Returns the TimeUnit to which durations should be converted, or null if the default should be used.
      • getAllowedOrigin

        protected java.lang.String getAllowedOrigin()
        Returns the Access-Control-Allow-Origin header value, if any.
      • contextInitialized

        public void contextInitialized​(javax.servlet.ServletContextEvent event)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent event)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener