You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rob Schroeder <sc...@gmail.com> on 2012/11/17 14:18:57 UTC

Intro, Wicket 6, RuntimeException error page

Hello,

I'm a new list member and I'll start with a quick introduction:

After one or two earlier, but aborted attempts to try and get into Wicket, I've 
finally decided to take the plunge now, even if only for some pending personal 
projects and possible future side-jobs. On my primary job as a Java SE/EE 
developer, JSF will most probably become the one-and-only web framework for the 
foreseeable future, which I don't like, but that's life.

While the mentioned attempts were with Wicket 1.3 and 1.4, it probably would 
seem stupid to start with anything but Wicket 6 now. 

It seems though that Wicket 6 introduced some major changes so that quite some 
of the docs, tips & tricks to be found on the web are no more applicable, 
including parts of the official Wicket Wiki and not really covered by the 
migration hints either; at least that's my impression after my initial dabblings 
in Wicket 6, which leads me to the first questions for which I found no hints so 
far:

In Wicket 1.5, there is a way to define a custom error page for 
RuntimeExceptions which knows about the causing exception, by extending 
WebRequestCycle and overriding the WebApplication's newRequestCycle method. In 
Wicket 6, I can use getApplicationSettings().setInternalErrorPage and     
getExceptionSettings().setUnexpectedExceptionDisplay, but within my error page 
class I don't see my Exception, then. Did I miss something?

Cheers,
Robert







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


Re: Intro, Wicket 6, RuntimeException error page

Posted by Rob Schroeder <sc...@gmail.com>.
Hi Jordi,

excellent, thanks!

It seems that the matter was discussed before, resulting in ticket 
https://issues.apache.org/jira/browse/WICKET-2659 with a proposal for a 
change to Wicket that would automatically pass an Exception to the page 
specified by getApplicationSettings().setInternalErrorPage if the page's 
class had a suitable constructor, but the proposal was voted down because 
of the existence of your approach.

Cheers,
Robert


On Sat, 17 Nov 2012 15:30:33 +0100, Jordi Deu-Pons wrote:

> Hi Robert,
> 
>  I'm using a custom error page in Wicket 6 adding a
> RequestCycleListener at WebApplication init like this:
> 
> /* In case of unhandled exception redirect it to a custom page */
> getRequestCycleListeners().add(new AbstractRequestCycleListener() {
>             @Override
>             public IRequestHandler onException(RequestCycle cycle,
> Exception e) {
>                 return new RenderPageRequestHandler(new
> PageProvider(new ExceptionErrorPage(e)));
>             }
> });
> 
> Here you can see that you get the exception on the constructor.
> 
> I'm not sure if there is a better way to do this in Wicket 6.
> 
> Best regards,
> 
>  Jordi.
> 
> On Sat, Nov 17, 2012 at 2:18 PM, Rob Schroeder <sc...@gmail.com> wrote:
> > Hello,
> >
> > I'm a new list member and I'll start with a quick introduction:
> >
> > After one or two earlier, but aborted attempts to try and get into Wicket, I've
> > finally decided to take the plunge now, even if only for some pending personal
> > projects and possible future side-jobs. On my primary job as a Java SE/EE
> > developer, JSF will most probably become the one-and-only web framework for the
> > foreseeable future, which I don't like, but that's life.
> >
> > While the mentioned attempts were with Wicket 1.3 and 1.4, it probably would
> > seem stupid to start with anything but Wicket 6 now.
> >
> > It seems though that Wicket 6 introduced some major changes so that quite some
> > of the docs, tips & tricks to be found on the web are no more applicable,
> > including parts of the official Wicket Wiki and not really covered by the
> > migration hints either; at least that's my impression after my initial dabblings
> > in Wicket 6, which leads me to the first questions for which I found no hints so
> > far:
> >
> > In Wicket 1.5, there is a way to define a custom error page for
> > RuntimeExceptions which knows about the causing exception, by extending
> > WebRequestCycle and overriding the WebApplication's newRequestCycle method. In
> > Wicket 6, I can use getApplicationSettings().setInternalErrorPage and
> > getExceptionSettings().setUnexpectedExceptionDisplay, but within my error page
> > class I don't see my Exception, then. Did I miss something?
> >
> > Cheers,
> > Robert
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> 
> 
> 
> -- 
> a10! i fins aviat.
> J:-Deu
> 
> ---------------------------------------------------------------------
> 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: Intro, Wicket 6, RuntimeException error page

Posted by Jordi Deu-Pons <jo...@jordeu.net>.
Hi Robert,

 I'm using a custom error page in Wicket 6 adding a
RequestCycleListener at WebApplication init like this:

/* In case of unhandled exception redirect it to a custom page */
getRequestCycleListeners().add(new AbstractRequestCycleListener() {
            @Override
            public IRequestHandler onException(RequestCycle cycle,
Exception e) {
                return new RenderPageRequestHandler(new
PageProvider(new ExceptionErrorPage(e)));
            }
});

Here you can see that you get the exception on the constructor.

I'm not sure if there is a better way to do this in Wicket 6.

Best regards,

 Jordi.

On Sat, Nov 17, 2012 at 2:18 PM, Rob Schroeder <sc...@gmail.com> wrote:
> Hello,
>
> I'm a new list member and I'll start with a quick introduction:
>
> After one or two earlier, but aborted attempts to try and get into Wicket, I've
> finally decided to take the plunge now, even if only for some pending personal
> projects and possible future side-jobs. On my primary job as a Java SE/EE
> developer, JSF will most probably become the one-and-only web framework for the
> foreseeable future, which I don't like, but that's life.
>
> While the mentioned attempts were with Wicket 1.3 and 1.4, it probably would
> seem stupid to start with anything but Wicket 6 now.
>
> It seems though that Wicket 6 introduced some major changes so that quite some
> of the docs, tips & tricks to be found on the web are no more applicable,
> including parts of the official Wicket Wiki and not really covered by the
> migration hints either; at least that's my impression after my initial dabblings
> in Wicket 6, which leads me to the first questions for which I found no hints so
> far:
>
> In Wicket 1.5, there is a way to define a custom error page for
> RuntimeExceptions which knows about the causing exception, by extending
> WebRequestCycle and overriding the WebApplication's newRequestCycle method. In
> Wicket 6, I can use getApplicationSettings().setInternalErrorPage and
> getExceptionSettings().setUnexpectedExceptionDisplay, but within my error page
> class I don't see my Exception, then. Did I miss something?
>
> Cheers,
> Robert
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
a10! i fins aviat.
J:-Deu

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