Use jakarta.servlet.error.exception request attribute on jetty11 (#8503)
This commit is contained in:
parent
00f381802a
commit
f00393260c
|
@ -57,6 +57,7 @@ public class JettyHelper<REQUEST, RESPONSE> extends ServletHelper<REQUEST, RESPO
|
|||
}
|
||||
|
||||
private static String errorExceptionAttributeName() {
|
||||
// this method is only used on jetty versions before 9.4
|
||||
return "javax.servlet.error.exception";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ abstract class JettyServlet5Test extends AbstractServlet5Test<Object, Object> {
|
|||
ServletContextHandler servletContext = new ServletContextHandler(null, contextPath)
|
||||
servletContext.errorHandler = new ErrorHandler() {
|
||||
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {
|
||||
Throwable th = (Throwable) request.getAttribute("javax.servlet.error.exception")
|
||||
Throwable th = (Throwable) request.getAttribute("jakarta.servlet.error.exception")
|
||||
writer.write(th ? th.message : message)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class JettyServletHandlerTest extends AbstractServlet5Test<Object, Object> {
|
|||
setupServlets(handler)
|
||||
server.addBean(new ErrorHandler() {
|
||||
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {
|
||||
Throwable th = (Throwable) request.getAttribute("javax.servlet.error.exception")
|
||||
Throwable th = (Throwable) request.getAttribute("jakarta.servlet.error.exception")
|
||||
writer.write(th ? th.message : message)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue