You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicolas Bouillon <ni...@bouil.org> on 2009/08/05 12:51:36 UTC

Custom RequestExceptionHandler. How ?

Hi,

I'm trying to override the DefaultRequestExceptionHandler.

My objective is just to wrap the DefaultrequestExceptionHandler to add  
some reporting of the exception (for example, sending an email to the  
maintenance team, and saving the exception details in database).

I'm follwing the cookbook here :  
http://tapestry.apache.org/tapestry5/cookbook/exceptions.html

I've created my custom class. It a simple extends call to super, with  
juste one line added to save exception.


     public class MyRequestExceptionHandler extends
             DefaultRequestExceptionHandler {

         private Request request;

         public MyRequestExceptionHandler(
                 RequestPageCache pageCache,
                 PageResponseRenderer renderer,
                 Logger logger,
                 @Inject  
@Symbol(SymbolConstants.EXCEPTION_REPORT_PAGE) String pageName,
                 Response response) {
             super(pageCache, renderer, logger, pageName, response);
         }

         @Override
         public void handleRequestException(Throwable exception)
                 throws IOException {
             ExceptionReporting.report(exception);
             super.handleRequestException(exception);
         }

     }

Then i try to add in my AppModule the binding to my class and the  
documentation tell me that i have to return an instance of the request  
exception handler. My problem is that i have no default constructor,  
and the DefaultRequestExceptionHandler seems to be instancied each  
time an exception is thrown.

How to do that ?

Thanks in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org