Class MonitorServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class MonitorServlet
    extends com.codahale.metrics.servlets.AdminServlet
    Monitor servlet for exposing Dropwizard metrics and health checks, requires an OAuth 2.0 bearer token for access.

    The access token is defined by a Java property obtained from 1) system properties or from 2) a properties file specified by servlet context parameter.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MonitorServlet.Configuration
      The monitor servlet access token configuration.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected MasterAccessTokenValidator tokenValidator
      The access token validator.
      • Fields inherited from class com.codahale.metrics.servlets.AdminServlet

        CPU_PROFILE_ENABLED_PARAM_KEY, CPU_PROFILE_URI_PARAM_KEY, DEFAULT_CPU_PROFILE_URI, DEFAULT_HEALTHCHECK_URI, DEFAULT_METRICS_URI, DEFAULT_PING_URI, DEFAULT_THREADS_URI, HEALTHCHECK_ENABLED_PARAM_KEY, HEALTHCHECK_URI_PARAM_KEY, METRICS_ENABLED_PARAM_KEY, METRICS_URI_PARAM_KEY, PING_ENABLED_PARAM_KEY, PING_URI_PARAM_KEY, SERVICE_NAME_PARAM_KEY, THREADS_ENABLED_PARAM_KEY, THREADS_URI_PARAM_KEY
    • Constructor Summary

      Constructors 
      Constructor Description
      MonitorServlet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void init​(javax.servlet.ServletConfig config)  
      protected void service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
    • Method Detail

      • init

        public void init​(javax.servlet.ServletConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class com.codahale.metrics.servlets.AdminServlet
        Throws:
        javax.servlet.ServletException
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doGet in class com.codahale.metrics.servlets.AdminServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • service

        protected void service​(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp)
                        throws javax.servlet.ServletException,
                               IOException
        Overrides:
        service in class com.codahale.metrics.servlets.AdminServlet
        Throws:
        javax.servlet.ServletException
        IOException