@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)
				|| monitoringDisabled || !instanceEnabled) {
			// si ce n'est pas une requête http ou si le monitoring est désactivé, on fait suivre
			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)) {
			// si cette url est exclue ou si le counter http est désactivé, on ne monitore pas cette requête http
			chain.doFilter(request, response);
			return;
		}

		doFilter(chain, httpRequest, httpResponse);
	}
@Test
	public void testDoFilterWithSessionTer() throws ServletException, IOException {
		final HttpServletRequest request = createNiceMock(HttpServletRequest.class);
		final HttpSession session = createNiceMock(HttpSession.class);
		expect(request.getSession(false)).andReturn(session);
		expect(session.getAttribute(SessionListener.SESSION_COUNTRY_KEY))
				.andReturn(Locale.FRANCE.getCountry()).anyTimes();
		expect(session.getAttribute(SessionListener.SESSION_REMOTE_ADDR)).andReturn("somewhere")
				.anyTimes();
		expect(session.getAttribute(SessionListener.SESSION_REMOTE_USER)).andReturn("me")
				.anyTimes();
		replay(session);
		doFilter(request);
		verify(session);
	}