You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alberto Brosich <ab...@ogs.trieste.it> on 2014/09/10 10:09:18 UTC

Custom http error pages

Hi,

I'm using the latest version of wicket.
I'm trying to write custom pages for http errors. The standard way,
using web.xml, is not useful for me because I would print custom
messages too.
I tried to write a RequestCycleListener extending
AbstractRequestCycleListener class, but it seems that
AbortWithHttpErrorCodeException exceptions do not trigger onException
method of the listener or they have been already consumed.

Which are the best way to do that?

Best regards.

Alberto


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


Re: Custom http error pages

Posted by Alberto Brosich <ab...@ogs.trieste.it>.
On Wed, 2014-09-10 at 11:21 +0300, Martin Grigorov wrote:
> Hi,
> 
> Instead of throwing AbortWithHttpErrorCodeException you can just use
> RestartResponseException/setResponsePage().
> But using the standard way (web.xml) should be fine too. I think the
> message set by #setError(code, message) is stored as request attribute.
> 

Hi Martin,

I used the second one and it works fine.

Many thanks

Alberto

> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Wed, Sep 10, 2014 at 11:09 AM, Alberto Brosich <ab...@ogs.trieste.it>
> wrote:
> 
> >
> > Hi,
> >
> > I'm using the latest version of wicket.
> > I'm trying to write custom pages for http errors. The standard way,
> > using web.xml, is not useful for me because I would print custom
> > messages too.
> > I tried to write a RequestCycleListener extending
> > AbstractRequestCycleListener class, but it seems that
> > AbortWithHttpErrorCodeException exceptions do not trigger onException
> > method of the listener or they have been already consumed.
> >
> > Which are the best way to do that?
> >
> > Best regards.
> >
> > Alberto
> >
> >
> > ---------------------------------------------------------------------
> > 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: Custom http error pages

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

Instead of throwing AbortWithHttpErrorCodeException you can just use
RestartResponseException/setResponsePage().
But using the standard way (web.xml) should be fine too. I think the
message set by #setError(code, message) is stored as request attribute.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Wed, Sep 10, 2014 at 11:09 AM, Alberto Brosich <ab...@ogs.trieste.it>
wrote:

>
> Hi,
>
> I'm using the latest version of wicket.
> I'm trying to write custom pages for http errors. The standard way,
> using web.xml, is not useful for me because I would print custom
> messages too.
> I tried to write a RequestCycleListener extending
> AbstractRequestCycleListener class, but it seems that
> AbortWithHttpErrorCodeException exceptions do not trigger onException
> method of the listener or they have been already consumed.
>
> Which are the best way to do that?
>
> Best regards.
>
> Alberto
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>