将重定向属性添加到闪存映射会导致以下异常
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2377)
at org.apache.catalina.connector.Request.getSession(Request.java:2097)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
at org.springframework.web.servlet.support.DefaultFlashMapManager.retrieveFlashMaps(DefaultFlashMapManager.java:149)
at org.springframework.web.servlet.support.DefaultFlashMapManager.requestCompleted(DefaultFlashMapManager.java:202)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:830)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
这就是我的请求处理程序的样子
@RequestMapping(value = "/foo", method = RequestMethod.POST)
public String getFoo(RedirectAttributes attr) {
attr.addFlashAttribute("twiddle", "doodle");
return "redirect:/cow";
}
有谁知道是什么原因导致这个/如何调试问题?