0
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
            //To change body of implemented methods use File | Settings | File Templates.
            logger.debug("   ++++++++++++++++++++++++ handler handling handling things :D        +++++++++++++++++++++ ");
             String love = (String) request.getAttribute("love");
         RequestDispatcher requestDispatcher = request.getRequestDispatcher("/error/403");
            logger.debug("   ++++++++++++++++++++++++ doing request forward     +++++++++++++++++++++ "+request.getAttribute("pain"));

            requestDispatcher.forward(request,response);
            request.setAttribute("love","love");

    //        response.sendRedirect(accessDeniedUrl);
    //
    //       request.getSession().setAttribute("message","You do not have permission to access this page!");


        }

这是我在实现 Spring Security 的 AccessDeniedHandler 之后的处理方法,它与 sendRedirect 配合得很好,但由于我需要在另一个地方请求请求,所以我必须使用请求调度程序,但它不起作用并给出 404。我已将所有日志记录级别置于调试和除了转到 404 页面外,甚至跟踪但没有打印错误。有任何想法吗?

4

0 回答 0