java—为什么accessdeniedhandler不能与请求调度器一起工作?

xzv2uavs  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(142)
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!");

        }

这是我的handle方法,在实现了springsecurity的accessdeniedhandler之后,它可以很好地与sendredirect一起工作,但是由于我在另一个地方需要请求,我不得不使用请求调度器,但是它不起作用,并且给出了404。我已经把所有的日志级别调试,甚至跟踪,但没有错误被打印除了去404页。有什么想法吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题