Olve Hansen <olve.hansen <at> intermedia.uib.no> writes:
> I have made a class that rethrows exceptions on a list, so that I can
> pass some exceptions on to some servlet filters.
>
> I overrode the activateErrorPage in BaseEngine:
> protected void activateExceptionPage(IRequestCycle iRequestCycle,
> ResponseOutputStream responseOutputStream, Throwable throwable)
> throws ServletException {
>
> ExceptionRethrower exceptionRethrower = (ExceptionRethrower)
> getBean("exceptionRethrower");
> exceptionRethrower.checkForRethrow(throwable);
> super.activateExceptionPage(iRequestCycle, responseOutputStream,
> throwable);
> }
>
> In this method you could do whatever you want, but if you call the super
> method, the exception page will appear.
>
> For this to work you would have to make a subclass of BaseEngine.
>
> What about detecting whether the asset is null, and make an empty asset.
> I thik this would trigger the alt part of the Image comp.
Daniel,
Depending on what you want to do after catching an exception, I found an
alternative to overriding BaseEngine that allowed normal page flow not to be
disrupted. That is, I couldn't override BaseEngine because it would return back
to my page leaving form items blank because some portion of the page rewind,
render had been skipped.
So to solve this, I found wrapping my listeners much less disruptive to the
normal Tapestry's page flow.
Source:
http://scm.sipfoundry.org/rep/sipXconfig/main/web/src/org/sipfoundry/sipxconfig/
components/TapestryContext.java
* Class: UserExceptionAdapter - inner class to handle exceptions
* Method: treatUserExceptionAsValidationError - I call this method explicitly
on listeners I want to intercept exceptions on
Page Specification:
http://scm.sipfoundry.org/rep/sipXconfig/main/web/context/WEB-INF/phone/EditPhon
e.page
This method is good only if you want to explicitly control select pages.
Global exception handling would required BaseEngine as Olve describes.
[BEGIN SHAMELESS JOB POSTING]
My company is looking for a Tapestry, Hibernate, Spring open source developer,
in Boston North area. See http://www.sipfoundry.org, or email me dhubler (at)
pingtel (dot) com.
[END SHAMELESS JOB POSTING]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]