@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final String uri = req.getPathInfo(); if (uri != null && jvmUri != null && uri.equals(jvmUri)) { jvmServlet.service(req, resp); } else { super.service(req, resp); } }
@Override public void init(ServletConfig config) throws ServletException { super.init(config); if (Boolean.valueOf(config.getInitParameter("show-jvm-metrics"))) { this.jvmServlet = new JVMMetricsServlet(); this.jvmServlet.init(config); this.jvmUri = DEFAULT_JVM_URI; } }