You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ondrej Zizka <oz...@redhat.com> on 2012/09/27 02:40:26 UTC

Redire

Hi all,

pls is there a way to react to certain type of exceptions and redirect
the request to a page?
I think I saw somathing, but I can't find it.

I can't wrap it in RestartResponseAtInterceptPageException as  in my
case it's thrown from within Wicket's code.

So, I'm looking for something like

      getApplicationSettings.setExceptionMapper( new ExceptionMapper()
           //                                             Type,
Destination
           .add(                                      Exception.class,
ExceptionPage.class )
           //             Component of origin,  Type,
Destination
           .add( LoginPage.class, Exception.class,  ExceptionPage.class
)
     );

Or maybe just  some exception handler with onException(),  like
http://blog.wizche.ch/2011/12/wicket-15custom-exception-page.html  - is
that the way? Not that convenient but usable.

Thanks,
Ondra

Re: Found IExceptionMapper // Re: Redirecting on Exception - some "ExceptionMapper"? Also for exceptions outside app's code

Posted by Ondrej Zizka <oz...@redhat.com>.
On Thu, 2012-09-27 at 09:58 +0300, Martin Grigorov wrote:


> > But still:
> > I only get the exception. Ok, it has a stacktrace. But for convenience,
> > is it possible that I could get the component it came from?
> 
> No
> But what would you do if you know that SomePanel did it ?


I would redirect to that page, and inform that processing this or that
failed.
Of course, the app shouldn't leak exceptions like that and they should
be caught at right places...
But that's a perfect state, and until that's reached, this could make
the app a bit more robust. But having just the exception is good enough.

Ondra


Re: Found IExceptionMapper // Re: Redirecting on Exception - some "ExceptionMapper"? Also for exceptions outside app's code

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

See https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5

On Thu, Sep 27, 2012 at 4:13 AM, Ondrej Zizka <oz...@redhat.com> wrote:
> Aah, just found in the referenced wiki:
>
> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Exceptionhandling
>
> or override org.apache.wicket.Application.getExceptionMapperProvider() -
> the IExceptionMapper is used if none of the configured
> IRequestCycleListeners doesn't know how to handle the exception.
> For information on how the request cycle handles exceptions see
> RequestCycle in Wicket 1.5 for more information
>
> So I would use BookmarkablePageRequestHandler or such.
> Nice... Wicket is like having Christmas all year :)
>
> But still:
> I only get the exception. Ok, it has a stacktrace. But for convenience,
> is it possible that I could get the component it came from?

No
But what would you do if you know that SomePanel did it ?

>
>
>
>
> On Thu, 2012-09-27 at 02:42 +0200, Ondrej Zizka wrote:
>
>> Sorry, adding a subject...
>>
>>
>> On Thu, 2012-09-27 at 02:40 +0200, Ondrej Zizka wrote:
>>
>> > Hi all,
>> >
>> > pls is there a way to react to certain type of exceptions and redirect
>> > the request to a page?
>> > I think I saw somathing, but I can't find it.
>> >
>> > I can't wrap it in RestartResponseAtInterceptPageException as  in my
>> > case it's thrown from within Wicket's code.
>> >
>> > So, I'm looking for something like
>> >
>> >       getApplicationSettings.setExceptionMapper( new ExceptionMapper()
>> >            //                                             Type,
>> > Destination
>> >            .add(                                      Exception.class,
>> > ExceptionPage.class )
>> >            //             Component of origin,  Type,
>> > Destination
>> >            .add( LoginPage.class, Exception.class,  ExceptionPage.class
>> > )
>> >      );
>> >
>> > Or maybe just  some exception handler with onException(),  like
>> > http://blog.wizche.ch/2011/12/wicket-15custom-exception-page.html  - is
>> > that the way? Not that convenient but usable.
>> >
>> > Thanks,
>> > Ondra
>>
>>
>
>



-- 
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


Found IExceptionMapper // Re: Redirecting on Exception - some "ExceptionMapper"? Also for exceptions outside app's code

Posted by Ondrej Zizka <oz...@redhat.com>.
Aah, just found in the referenced wiki:

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

or override org.apache.wicket.Application.getExceptionMapperProvider() -
the IExceptionMapper is used if none of the configured
IRequestCycleListeners doesn't know how to handle the exception.
For information on how the request cycle handles exceptions see
RequestCycle in Wicket 1.5 for more information

So I would use BookmarkablePageRequestHandler or such.
Nice... Wicket is like having Christmas all year :)

But still:
I only get the exception. Ok, it has a stacktrace. But for convenience,
is it possible that I could get the component it came from?




On Thu, 2012-09-27 at 02:42 +0200, Ondrej Zizka wrote:

> Sorry, adding a subject...
> 
> 
> On Thu, 2012-09-27 at 02:40 +0200, Ondrej Zizka wrote:
> 
> > Hi all,
> > 
> > pls is there a way to react to certain type of exceptions and redirect
> > the request to a page?
> > I think I saw somathing, but I can't find it.
> > 
> > I can't wrap it in RestartResponseAtInterceptPageException as  in my
> > case it's thrown from within Wicket's code.
> > 
> > So, I'm looking for something like
> > 
> >       getApplicationSettings.setExceptionMapper( new ExceptionMapper()
> >            //                                             Type,
> > Destination
> >            .add(                                      Exception.class,
> > ExceptionPage.class )
> >            //             Component of origin,  Type,
> > Destination
> >            .add( LoginPage.class, Exception.class,  ExceptionPage.class
> > )
> >      );
> > 
> > Or maybe just  some exception handler with onException(),  like
> > http://blog.wizche.ch/2011/12/wicket-15custom-exception-page.html  - is
> > that the way? Not that convenient but usable.
> > 
> > Thanks,
> > Ondra
> 
> 



Redirecting on Exception - some "ExceptionMapper"? Also for exceptions outside app's code

Posted by Ondrej Zizka <oz...@redhat.com>.
Sorry, adding a subject...


On Thu, 2012-09-27 at 02:40 +0200, Ondrej Zizka wrote:

> Hi all,
> 
> pls is there a way to react to certain type of exceptions and redirect
> the request to a page?
> I think I saw somathing, but I can't find it.
> 
> I can't wrap it in RestartResponseAtInterceptPageException as  in my
> case it's thrown from within Wicket's code.
> 
> So, I'm looking for something like
> 
>       getApplicationSettings.setExceptionMapper( new ExceptionMapper()
>            //                                             Type,
> Destination
>            .add(                                      Exception.class,
> ExceptionPage.class )
>            //             Component of origin,  Type,
> Destination
>            .add( LoginPage.class, Exception.class,  ExceptionPage.class
> )
>      );
> 
> Or maybe just  some exception handler with onException(),  like
> http://blog.wizche.ch/2011/12/wicket-15custom-exception-page.html  - is
> that the way? Not that convenient but usable.
> 
> Thanks,
> Ondra