我正在尝试在我的 spring 应用程序和 tomcat 中模拟 http 503 状态。所以我创建了一个控制器:
@RequestMapping(value = "/503", method = RequestMethod.GET)
public String error(final HttpServletRequest request, final HttpServletResponse response, final ModelMap model)
{
response.setStatus(503);
return null;
}
在 web xml 中我设置了过滤器:
<error-page>
<error-code>503</error-code>
<location>/WEB-INF/views/errorpages/simple503.jsp</location>
</error-page>
当我调用 /503 控制器时,会显示典型的 503 tomcat 页面(没有我想显示的页面)并称为我的 404 控制器。
我想这是由 503 控制器中的 return null 引起的......那么我该怎么做才能返回我的错误页面?
谢谢