Hi,

Am Freitag, den 03.12.2010, 17:36 -0500 schrieb sam lee: 
> I want to handle uncaught exceptions only some times.
> 
> According to this page:
> http://sling.apache.org/site/errorhandling.html
> 
> I created /apps/sling/servlet/errorhandler/Throwable.jsp
> 
> But, only when some conditions are met, I want to use custom Throwable.jsp.
> Other times, I want sling to use
> 
> org.apache.sling.servlets.resolver.internal.defaults.DefaultErrorHandlerServlet.
> 
> Since I am overriding Throwable.jsp,  how can I call
> DefaultErrorHandlerServlet inside Throwable.jsp?
> 
> in Throwable.jsp:
> 
> if (shouldUseCustomTemplate()) {
>     //do my thing
> } else {
>     new DefaultErrorHandlerServlet.doGet(request, response);
> }

Instead of writing a JSP you could register a Servlet service with a
servlet object implementing the OptingServlet interface. Upon the
accepts method call you might decide whether to handle the error
condition or not.

Thus if the servlet decides to handle, it is called. If the servlet
decides not handle the condition, another servlet is looked up.

Hope this helps.

Regards
Felix


Reply via email to