You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2011/07/19 11:35:06 UTC

[Migration 1.5]: exception handling in request cycle

Hi,

I'm trying to plug into the new request cycle processor of 1.5-RC5.1. I am 
following the instructions in the wiki page, but I seem to have run into some 
out-of-date info. So, according to:

https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle:


1) I must create a class implementing IRequestCycleListener
2) I must bind my listener during application init() with 
getRequestCycleListeners().add(...);

My problem is that previously when we extended the WebRequestCycle, we would 
preserve the default exception handling by using:

    @Override
    public Page onRuntimeException(Page page, RuntimeException e) {
        return super.onRuntimeException(page, e);
    }

Now, the wiki page claims that in my listener I can:

public void onException(Exception ex) { /*do nothing*/} However, the new 
listener interface forces you to return a handler (IRequestHandler), it does not 
return void as claimed in the wiki. So what do I do to return something that 
will tell Wicket to proceed with its default Exception handling? The actual 
signature is:

public IRequestHandler onException(RequestCycle cycle, Exception ex) {
      // what do I return in order not to interfere?
}

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


Re: [Migration 1.5]: exception handling in request cycle

Posted by Alexandros Karypidis <ak...@yahoo.gr>.
Ok, thx.

In terms of improving the wiki, I guess my source of confusion was that I was 
reading: 
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-RequestCycle



I fixed the signature of onException(...) and also added some comments in the 
sample request listener implementation (indicating that you may return null).

Finally, I added a link to the page you directed me to in the "Exception 
Handling" section immediately afterwards which only mentioned the exception 
mapper. This should help one find that the mapper is used only in case all of 
the listeners return null.

Alex.



----- Original Message ----
From: Martin Grigorov <mg...@apache.org>
To: users@wicket.apache.org
Sent: Tue, July 19, 2011 12:47:54 PM
Subject: Re: [Migration 1.5]: exception handling in request cycle

See the last point at
https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
Please update the wiki page after this.

The Migration wiki page has a "Note" point at the top that there is a
Wiki label at the bottom clicking on which will show you all pages
with info about 1.5.
It seems this note is not quite visible to the users. Ideas how to
improve that is welcome!


On Tue, Jul 19, 2011 at 12:35 PM, Alexandros Karypidis
<ak...@yahoo.gr> wrote:
> Hi,
>
> I'm trying to plug into the new request cycle processor of 1.5-RC5.1. I am
> following the instructions in the wiki page, but I seem to have run into some
> out-of-date info. So, according to:
>
>https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle:
>:
>
>
> 1) I must create a class implementing IRequestCycleListener
> 2) I must bind my listener during application init() with
> getRequestCycleListeners().add(...);
>
> My problem is that previously when we extended the WebRequestCycle, we would
> preserve the default exception handling by using:
>
>    @Override
>    public Page onRuntimeException(Page page, RuntimeException e) {
>        return super.onRuntimeException(page, e);
>    }
>
> Now, the wiki page claims that in my listener I can:
>
> public void onException(Exception ex) { /*do nothing*/} However, the new
> listener interface forces you to return a handler (IRequestHandler), it does 
>not
> return void as claimed in the wiki. So what do I do to return something that
> will tell Wicket to proceed with its default Exception handling? The actual
> signature is:
>
> public IRequestHandler onException(RequestCycle cycle, Exception ex) {
>      // what do I return in order not to interfere?
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

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


Re: [Migration 1.5]: exception handling in request cycle

Posted by Martin Grigorov <mg...@apache.org>.
See the last point at
https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
Please update the wiki page after this.

The Migration wiki page has a "Note" point at the top that there is a
Wiki label at the bottom clicking on which will show you all pages
with info about 1.5.
It seems this note is not quite visible to the users. Ideas how to
improve that is welcome!


On Tue, Jul 19, 2011 at 12:35 PM, Alexandros Karypidis
<ak...@yahoo.gr> wrote:
> Hi,
>
> I'm trying to plug into the new request cycle processor of 1.5-RC5.1. I am
> following the instructions in the wiki page, but I seem to have run into some
> out-of-date info. So, according to:
>
> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle:
>
>
> 1) I must create a class implementing IRequestCycleListener
> 2) I must bind my listener during application init() with
> getRequestCycleListeners().add(...);
>
> My problem is that previously when we extended the WebRequestCycle, we would
> preserve the default exception handling by using:
>
>    @Override
>    public Page onRuntimeException(Page page, RuntimeException e) {
>        return super.onRuntimeException(page, e);
>    }
>
> Now, the wiki page claims that in my listener I can:
>
> public void onException(Exception ex) { /*do nothing*/} However, the new
> listener interface forces you to return a handler (IRequestHandler), it does not
> return void as claimed in the wiki. So what do I do to return something that
> will tell Wicket to proceed with its default Exception handling? The actual
> signature is:
>
> public IRequestHandler onException(RequestCycle cycle, Exception ex) {
>      // what do I return in order not to interfere?
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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