@Test public void shouldSkipRequestToProject() throws Exception { when(request.getMethod()).thenReturn("GET"); when(request.getRequestURI()).thenReturn("/namespace/ws-id/project1"); when(request.getRequestURL()) .thenReturn(new StringBuffer("http: filter.doFilter(request, response, chain); verify(chain).doFilter(nullable(ServletRequest.class), nullable(ServletResponse.class)); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; if ("GET".equals(req.getMethod()) && !projectPattern.matcher(req.getRequestURI()).matches()) { resp.sendRedirect("/dashboard/"); return; } chain.doFilter(request, response); }
DashboardRedirectionFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; if ("GET".equals(req.getMethod()) && !projectPattern.matcher(req.getRequestURI()).matches()) { resp.sendRedirect("/dashboard/"); return; } chain.doFilter(request, response); } }
DashboardRedirectionFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; if ("GET".equals(req.getMethod()) && !projectPattern.matcher(req.getRequestURI()).matches()) { resp.sendRedirect("/dashboard/"); return; } chain.doFilter(request, response); }  }
DashboardRedirectionFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; if ("GET".equals(req.getMethod()) && !projectPattern.matcher(req.getRequestURI()).matches()) { resp.sendRedirect("/dashboard/"); return; } chain.doFilter(request, response); }  @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void init(FilterConfig filterConfig); @Override void destroy(); }
DashboardRedirectionFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; if ("GET".equals(req.getMethod()) && !projectPattern.matcher(req.getRequestURI()).matches()) { resp.sendRedirect("/dashboard/"); return; } chain.doFilter(request, response); }  @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void init(FilterConfig filterConfig); @Override void destroy();  }