You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tom Götz <to...@decoded.de> on 2014/02/19 16:53:10 UTC

Central exception handling using a custom RequestCycleListener

Hi there,

we’d like to implement a centralized exception handling strategy for backend/service calls from with within Wicket components. Therefor I thought it could be a good idea to do this in a custom org.apache.wicket.request.cycle.AbstractRequestCycleListener#onException implementation. Depending on the caught exception we’d potentially like to do some cleanup logic (i.e. call methods on the currently requested page).

I’m not sure what is the best strategy to get the page instance in onException, and what about ajax requests? And hints or pointers?


Cheers,
   -Tom




Re: Central exception handling using a custom RequestCycleListener

Posted by Tom Götz <to...@richmountain.de>.
Nice, I’ll have a look at that thingy ;-)

Thanks,
   -Tom


On 19.02.2014, at 16:56, Martin Grigorov <mg...@apache.org> wrote:

> Hi,
> 
> You may use another IRequestCycleListener to track the last processed page
> - org.apache.wicket.request.cycle.PageRequestHandlerTracker
> 
> Martin Grigorov
> Wicket Training and Consulting
> 
> 
> On Wed, Feb 19, 2014 at 5:53 PM, Tom Götz <to...@decoded.de> wrote:
> 
>> Hi there,
>> 
>> we’d like to implement a centralized exception handling strategy for
>> backend/service calls from with within Wicket components. Therefor I
>> thought it could be a good idea to do this in a custom
>> org.apache.wicket.request.cycle.AbstractRequestCycleListener#onException
>> implementation. Depending on the caught exception we’d potentially like to
>> do some cleanup logic (i.e. call methods on the currently requested page).
>> 
>> I’m not sure what is the best strategy to get the page instance in
>> onException, and what about ajax requests? And hints or pointers?
>> 
>> 
>> Cheers,
>>   -Tom
>> 
>> 
>> 
>> 


Re: Central exception handling using a custom RequestCycleListener

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You may use another IRequestCycleListener to track the last processed page
- org.apache.wicket.request.cycle.PageRequestHandlerTracker

Martin Grigorov
Wicket Training and Consulting


On Wed, Feb 19, 2014 at 5:53 PM, Tom Götz <to...@decoded.de> wrote:

> Hi there,
>
> we’d like to implement a centralized exception handling strategy for
> backend/service calls from with within Wicket components. Therefor I
> thought it could be a good idea to do this in a custom
> org.apache.wicket.request.cycle.AbstractRequestCycleListener#onException
> implementation. Depending on the caught exception we’d potentially like to
> do some cleanup logic (i.e. call methods on the currently requested page).
>
> I’m not sure what is the best strategy to get the page instance in
> onException, and what about ajax requests? And hints or pointers?
>
>
> Cheers,
>    -Tom
>
>
>
>