Skip to content

Use jakarta.servlet.error.exception request attribute on jetty11 #8503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private Throwable errorException(REQUEST request) {
}

private static String errorExceptionAttributeName() {
// this method is only used on jetty versions before 9.4
return "javax.servlet.error.exception";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down