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安全的AccessDeniedHandler之后的句柄方法,它适用于sendRedirect但是因为我需要在另一个地方请求我必须使用请求调度程序,但它不起作用并给出404.我已经把所有日志记录级别在调试甚至跟踪,但没有打印错误,除了转到404页面。有什么想法吗?