public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); String excludedExtensionsParam = filterConfig.getInitParameter("excludedExtensions"); if (excludedExtensionsParam != null) { StringTokenizer tokenizer = new StringTokenizer(excludedExtensionsParam, ",", false); while (tokenizer.hasMoreTokens()) { excludedExtensions.add(tokenizer.nextToken().trim()); } } }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; // do not use the filter if this is a server-side include, JSP, or image file if (httpRequest.getAttribute(INCLUDE_REQUEST_URI_ATTRIBUTE) == null && (!isExcludedFileExtension(httpRequest.getPathInfo()))) { super.doFilter(request, response, chain); } else { chain.doFilter(request, response); } }