Closed shesio closed 6 years ago
解决方法,在WebConfig以下方法中对view进行判空 @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView view) { CsrfToken token = (CsrfToken) request.getAttribute(CsrfToken.class.getName()); if (token != null&&view!=null) { view.addObject(token.getParameterName(), token); } }
登录后,转向/admin 路径时会出这个错 Caused by: java.lang.IllegalStateException: STREAM at org.eclipse.jetty.server.Response.getWriter(Response.java:891) [jetty-server-9.3.11.v20160721.jar:9.3.11.v20160721] at de.neuland.jade4j.spring.view.JadeView.doRender(JadeView.java:40) ~[spring-jade4j-0.4.2.jar:na] at de.neuland.jade4j.spring.view.JadeView.renderMergedTemplateModel(JadeView.java:30) ~[spring-jade4j-0.4.2.jar:na] at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) ~[spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... 108 common frames omitted 2016-10-19 22:01:52.077 [qtp715160960-23] ERROR c.r.b.e.ExceptionHandlerController - Request page: /error raised exception : java.lang.NullPointerException 2016-10-19 22:01:52.079 [qtp715160960-23] WARN o.e.j.s.handler.ErrorHandler - EXCEPTION