@Test public void testWithRequestSessionIdValid() throws IOException, ServletException { final int sessionCount = SessionListener.getSessionCount(); final HttpServletRequest request = createNiceMock(HttpServletRequest.class); final HttpServletResponse response = createNiceMock(HttpServletResponse.class); final FilterChain chain = createNiceMock(FilterChain.class); expect(request.getRequestURI()).andReturn(CONTEXT_PATH + TEST_REQUEST).anyTimes(); expect(request.getContextPath()).andReturn(CONTEXT_PATH).anyTimes(); expect(request.isRequestedSessionIdValid()).andReturn(true).anyTimes(); expect(request.getLocale()).andReturn(Locale.FRANCE).anyTimes(); replay(request); replay(response); replay(chain); pluginMonitoringFilter.doFilter(request, response, chain); assertEquals("sessionCount", sessionCount, SessionListener.getSessionCount()); verify(request); verify(response); verify(chain); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { super.doFilter(request, response, chain); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; registerSessionIfNeeded(httpRequest); super.doFilter(request, response, chain); unregisterSessionIfNeeded(httpRequest); }
PluginMonitoringFilter extends MonitoringFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { super.doFilter(request, response, chain); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; registerSessionIfNeeded(httpRequest); super.doFilter(request, response, chain); unregisterSessionIfNeeded(httpRequest); } }
PluginMonitoringFilter extends MonitoringFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { super.doFilter(request, response, chain); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; registerSessionIfNeeded(httpRequest); super.doFilter(request, response, chain); unregisterSessionIfNeeded(httpRequest); }  }
PluginMonitoringFilter extends MonitoringFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { super.doFilter(request, response, chain); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; registerSessionIfNeeded(httpRequest); super.doFilter(request, response, chain); unregisterSessionIfNeeded(httpRequest); }  @Override void init(FilterConfig config); @Override void destroy(); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); static void logForDebug(String msg); }
PluginMonitoringFilter extends MonitoringFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { super.doFilter(request, response, chain); return; } final HttpServletRequest httpRequest = (HttpServletRequest) request; registerSessionIfNeeded(httpRequest); super.doFilter(request, response, chain); unregisterSessionIfNeeded(httpRequest); }  @Override void init(FilterConfig config); @Override void destroy(); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); static void logForDebug(String msg);  }