Created
February 17, 2018 08:46
-
-
Save chkal/38d385a290e6e906fa8ede1cfc08d1ab to your computer and use it in GitHub Desktop.
NoopServletFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebFilter("/*") | |
public class NoopServletFilter implements Filter { | |
@Override | |
public void init(FilterConfig filterConfig) throws ServletException { | |
// empty | |
} | |
@Override | |
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) | |
throws IOException, ServletException { | |
HttpServletRequest request = (HttpServletRequest) servletRequest; | |
HttpServletResponse response = (HttpServletResponse) servletResponse; | |
if (request.getRequestURI().matches("^.*/rfRes/bla.css$")) { | |
response.setStatus(204); | |
response.flushBuffer(); | |
} else { | |
filterChain.doFilter(request, response); | |
} | |
} | |
@Override | |
public void destroy() { | |
// empty | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment