this is what I do
/**
* @see
org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
* org.apache.wicket.Response)
*/
public RequestCycle newRequestCycle(final Request request, final Response
response)
{
return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response)
{
@Override
public Page onRuntimeException(Page page, RuntimeException e)
{
if(PageExpiredException.class.isAssignableFrom(e.getClass()))
{
return null;
}
return new ErrorPage(e,page);
}
};
}
Cheers
Dipu
On Thu, Nov 27, 2008 at 2:18 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:
> Thanks,
>
> but looking at WebRequestCycleProcessor I didn't see onRuntimeException
> method.
> We use 1.3.4 version
>
> Looking at AbstractRequestCycleProcessor:respond, I see the call:
> if (responseClass != internalErrorPageClass &&
> settings.getUnexpectedExceptionDisplay() ==
> IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
> {
> throw new RestartResponseException(internalErrorPageClass);
> }
>
> And I also see that RestartResponseException has a constructor with
> PageParameters.
>
> Is there a nice way to call the constructor with the parameters in respond
> ?
> Without overriding all this method?
>
> Thanks
>
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>
>
> On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer <[EMAIL PROTECTED]
> >wrote:
>
> >
> > the first possibility that comes to my mind is overriding the following
> > method in your application:
> >
> > @Override
> > protected IRequestCycleProcessor newRequestCycleProcessor() {
> > return new WebRequestCycleProcessor() {
> >
> > @Override
> > protected Page onRuntimeException(final Page page,
> > final RuntimeException
> > e) {
> > // do the default handling on
> > pageexpiredexceptions
> > if (e instanceof PageExpiredException || e
> > instanceof
> > AuthorizationException) {
> > return null;
> > }
> > return new InternalServerError(page, e);
> //
> > e.getCause for your NPE
> > }
> >
> > };
> > }
> >
> > egolan74 wrote:
> > >
> > > Hi,
> > > In deployment, we set our own internal error page:
> > > getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
> > > and
> > > getExceptionSettings().setUnexpectedExceptionDisplay(
> > > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
> > >
> > > Is there a quick way to get the type of the exception and show a
> > different
> > > message in our internal error page accordingly?
> > > For example: if we get NullPointerException, show a message: "You
> > > developer
> > > coded null !!! .
> > > And ArrayIndexOutOfBoundException will show: "oops.. the array is too
> > > small"
> > > .
> > >
> > > Thanks
> > >
> > > Eyal Golan
> > > [EMAIL PROTECTED]
> > >
> > > Visit: http://jvdrums.sourceforge.net/
> > > LinkedIn: http://www.linkedin.com/in/egolan74
> > >
> > > P Save a tree. Please don't print this e-mail unless it's really
> > > necessary
> > >
> > >
> > > -----
> > > Eyal Golan
> > > [EMAIL PROTECTED]
> > >
> > > Visit: JVDrums
> > > LinkedIn: LinkedIn
> > >
> >
> >
> > -----
> > Michael Sparer
> > http://talk-on-tech.blogspot.com
> > --
> > View this message in context:
> > http://www.nabble.com/Hand-on-session-code-tp20719154p20719327.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>