Replace current errorhandler mechanism by a more flexible one
-------------------------------------------------------------
Key: SLING-140
URL: https://issues.apache.org/jira/browse/SLING-140
Project: Sling
Issue Type: Improvement
Components: Core
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: 2.0.0
Currently error handling is supported by calling ErrorHandlerServlets which
must be registered as OSGi services. Error handling scripts are not supported
at the moment. This mechanism should be replaced by leveraging the Servlet and
Script resolution mechanism built into Sling for normal request processing.
For more information and background see the dev list thread [1].
(1) for status codes.
This handling is called whenever HttpServletResponse.sendError is called
regardless of the actual status code. HttpServletResponse.setStatus will not
trigger this error handling !
Servlet s = resolveScriptOrServlet(code);
if (s == null) {
s = resolveScriptOrServlet(500);
}
if (s == null) {
s = defaultErrorHandlerServlet;
}
(2) Likewise for Throwables it would be:
This handling is called whenever an uncaught Throwable (also IOException and
ServletException) is caught by the SlingMainServlet.
Class<?> tClass = throwable.getClass();
Servlet s = null;
while (s == null && tClass != Object.class) {
s = resolveScriptOrServlet(tClass.getSimpleName().toLowerCase());
tClass = tClass.getSuperclass();
}
if (s == null) {
s = resolveScriptOrServlet(500);
}
if (s == null) {
s = defaultErrorHandlerServlet;
}
[1] http://www.mail-archive.com/[email protected]/msg01388.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.