【发布时间】:2015-06-07 18:24:00
【问题描述】:
我有以下异常处理程序,当找不到资源时重定向到“未找到”页面。但是,在 apache 日志中,我没有看到 404 错误代码。有没有办法让这个异常处理程序抛出 404 错误?
@ExceptionHandler(UnknownIdentifierException.class)
public String handleUnknownIdentifierException(final UnknownIdentifierException e, final HttpServletRequest request)
{
request.setAttribute("message", e.getMessage());
return "forward:notfoundpage";
}
【问题讨论】:
标签: java spring spring-mvc jakarta-ee http-status-code-404