Class 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 Detail

      • ContextListener

        public ContextListener()
    • Method Detail

      • getRateUnit

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

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

        protected String getAllowedOrigin()
        Returns:
        the Access-Control-Allow-Origin header value, if any.
      • getJsonpCallbackParameter

        protected String getJsonpCallbackParameter()
        Returns the name of the parameter used to specify the jsonp callback, 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