@Test public void testDoMonitoringWithRum() throws ServletException, IOException { try { setProperty(Parameter.RUM_ENABLED, Boolean.TRUE.toString()); setUp(); final HttpServletRequest requestForRum = createNiceMock(HttpServletRequest.class); expect(requestForRum.getHeader("accept")).andReturn("text/html"); expect(requestForRum.getInputStream()) .andReturn(createInputStreamForString("<html><body>test</body></html>")) .anyTimes(); doFilter(requestForRum); monitoring(Collections.singletonMap(HttpParameter.RESOURCE, "boomerang.min.js")); monitoring(Collections.<HttpParameter, String> emptyMap()); monitoring(Collections.singletonMap(HttpParameter.PART, HttpPart.RUM.getName()), false); final Map<String, String> rumMap = new HashMap<String, String>(); rumMap.put(HttpParameter.PART.getName(), HttpPart.RUM.getName()); rumMap.put("requestName", TEST_REQUEST + " GET"); rumMap.put("serverTime", "100"); rumMap.put("timeToFirstByte", "100"); rumMap.put("domProcessing", "50"); rumMap.put("pageRendering", "50"); monitoring0(rumMap, false); final Map<HttpParameter, String> graphMap = new HashMap<HttpParameter, String>(); graphMap.put(HttpParameter.PART, HttpPart.GRAPH.getName()); final String requestId = new CounterRequest(TEST_REQUEST + " GET", Counter.HTTP_COUNTER_NAME).getId(); graphMap.put(HttpParameter.GRAPH, requestId); monitoring(graphMap); graphMap.put(HttpParameter.PERIOD, Period.TOUT.getCode()); monitoring(graphMap); graphMap.put(HttpParameter.FORMAT, "pdf"); monitoring(graphMap); } finally { setProperty(Parameter.RUM_ENABLED, null); } }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse) || monitoringDisabled || !instanceEnabled) { chain.doFilter(request, response); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { doMonitoring(httpRequest, httpResponse); return; } if (!httpCounter.isDisplayed() || isRequestExcluded((HttpServletRequest) request)) { chain.doFilter(request, response); return; } doFilter(chain, httpRequest, httpResponse); }
MonitoringFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse) || monitoringDisabled || !instanceEnabled) { chain.doFilter(request, response); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { doMonitoring(httpRequest, httpResponse); return; } if (!httpCounter.isDisplayed() || isRequestExcluded((HttpServletRequest) request)) { chain.doFilter(request, response); return; } doFilter(chain, httpRequest, httpResponse); } }
MonitoringFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse) || monitoringDisabled || !instanceEnabled) { chain.doFilter(request, response); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { doMonitoring(httpRequest, httpResponse); return; } if (!httpCounter.isDisplayed() || isRequestExcluded((HttpServletRequest) request)) { chain.doFilter(request, response); return; } doFilter(chain, httpRequest, httpResponse); } MonitoringFilter(); }
MonitoringFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse) || monitoringDisabled || !instanceEnabled) { chain.doFilter(request, response); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { doMonitoring(httpRequest, httpResponse); return; } if (!httpCounter.isDisplayed() || isRequestExcluded((HttpServletRequest) request)) { chain.doFilter(request, response); return; } doFilter(chain, httpRequest, httpResponse); } MonitoringFilter(); String getApplicationType(); void setApplicationType(final String applicationType); @Override void init(FilterConfig config); @Override void destroy(); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); static void registerApplicationNodeInCollectServer(String applicationName,
			URL collectServerUrl, URL applicationNodeUrl); static void unregisterApplicationNodeInCollectServer(); }
MonitoringFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse) || monitoringDisabled || !instanceEnabled) { chain.doFilter(request, response); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; final HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { doMonitoring(httpRequest, httpResponse); return; } if (!httpCounter.isDisplayed() || isRequestExcluded((HttpServletRequest) request)) { chain.doFilter(request, response); return; } doFilter(chain, httpRequest, httpResponse); } MonitoringFilter(); String getApplicationType(); void setApplicationType(final String applicationType); @Override void init(FilterConfig config); @Override void destroy(); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); static void registerApplicationNodeInCollectServer(String applicationName,
			URL collectServerUrl, URL applicationNodeUrl); static void unregisterApplicationNodeInCollectServer();  }