You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2007/12/18 15:02:43 UTC

[jira] Created: (SLING-140) Replace current errorhandler mechanism by a more flexible one

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/sling-dev@incubator.apache.org/msg01388.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-140) Replace current errorhandler mechanism by a more flexible one

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed SLING-140.
-----------------------------------

    Resolution: Fixed

By creating a separate project for the ServletResolver (sling/servlet-resolver) (see SLING-141) the error handler has also been moved to that new project and the proposed functionality has been implemented.

> 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/sling-dev@incubator.apache.org/msg01388.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.