- Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Closed
Copy link
Description
Affects: 2.7.9 - 3.2.3 (Likely more, I just tested the latest and a random 2.7)
When using @WebFilter with either the value or urlPatterns fields defined, Spring fails to respect them. It would make sense that the following behaves the same.
@Webfilter("/rest/example/*") @Component public static class SimpleFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { filterChain.doFilter(request, response); } } // Should behavior similar to @Webfilter @Component public static class SimpleFilter extends OncePerRequestFilter { @Override protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException { return !request.getRequestURI().startsWith("/rest/example"); } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { filterChain.doFilter(request, response); } }A repository configured with all three WebFilter variations and tests for them can be found here.
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug