You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Douglas Ferguson <th...@gmail.com> on 2012/03/01 08:46:44 UTC

onException() 1.5

I want to redirect to an error page when there is an Exception.

I see that there is a RedirectRequestHandler, but this only allows you to redirect to url via string literal.
I want to redirect to a construction Page.

I was grasping at straws and tried this and no dice..


	    		public IRequestHandler onException(RequestCycle cycle, Exception ex)
	    		{
	    			cycle.setResponsePage(new NotifyUserOfException());
	    			return cycle.getActiveRequestHandler();
	    		}

Re: onException() 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Mar 1, 2012 at 9:46 AM, Douglas Ferguson <th...@gmail.com> wrote:
> I want to redirect to an error page when there is an Exception.
>
> I see that there is a RedirectRequestHandler, but this only allows you to redirect to url via string literal.
> I want to redirect to a construction Page.
>
> I was grasping at straws and tried this and no dice..
>
>
>                        public IRequestHandler onException(RequestCycle cycle, Exception ex)
>                        {
>                                cycle.setResponsePage(new NotifyUserOfException());
>                                return cycle.getActiveRequestHandler();

WebPage exceptionPage = new NotifyUserOfException(ex);
IPageProvider provider = new PageProvider(page);
return new RenderPageRequestHandler(provider /*,
RenderPageRequestHandler.RedirectPolicy.XYZ */ );

>                        }



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