加过滤器后css样式还有图片不显示

  在使用登录过滤器之后,图片不显示,原来是css和图片都被过滤掉了,怎样解决呢?
下面的代码块可以解决这类问题

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request=(HttpServletRequest)req;
HttpServletResponse response=(HttpServletResponse)res;
HttpSession session=request.getSession();
Member member=(Member) session.getAttribute("member");
if(member==null){
StringBuffer fileURL = request.getRequestURL();
        if (fileURL.indexOf(".jpg") > 0 || fileURL.indexOf(".bmp") > 0
            || fileURL.indexOf(".gif") > 0|| fileURL.indexOf(".css") > 0|| fileURL.indexOf("login.jsp") > 0
            || fileURL.indexOf("authImg") > 0|| fileURL.indexOf("login.action") > 0 || fileURL.indexOf(".png") > 0) {
                chain.doFilter(request, response);
                return;
               }
response.sendRedirect(request.getContextPath()+"/jsp/pages/login.jsp");
}

chain.doFilter(request, response);
}

你可能感兴趣的:(css)