Nicer? Well it's quite the same with the difference that I overrode the cycle
processor and Dipu just the cycle ... I suspect you didn't find the right
method to override ;-)
regards,
Michael
egolan74 wrote:
>
> Thanks Dipu and Michael,
>
> Michael, you understood correctly.
> I used Dipu's solution as it looks nicer (no offend Michael :) )
> However, I added a check for development / deployment.
> And this is my (almost) final method.
> /**
> * @see
> org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
> * org.apache.wicket.Response)
> */
> @Override
> 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 (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) {
> if
> (PageExpiredException.class.isAssignableFrom(e.getClass())) {
> return null;
> }
> return new InternalErrorPage();
> } else {
> // In development we want to see the exception
> return null;
> }
>
> }
> };
> }
>
> All I need now is to work on the InternalErrorPage to get parameters and
> add
> the information.
>
> I have noticed one thing.
> Overriding this method caused the
> getExceptionSettings().setUnexpectedExceptionDisplay to be overridden.
>
> Thanks again, that was very much helpful.
>
>
> 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 4:27 PM, Michael Sparer
> <[EMAIL PROTECTED]>wrote:
>
>>
>> What do you mean by saying you "didn't see onRuntimeException" in
>> WebRequestCycleProcessor? If you didn't find it there it's because it's a
>> method of its base class ;-)
>>
>> What I didn't mention when providing the code was that it's actually
>> returning a Page (our internal server error page) and gets the Exception
>> that caused the pain in the constructor. I might be misunderstanding you,
>> but wasn't that the thing you wanted? Displaying different stuff in your
>> error page based on what Exception was thrown?
>>
>> regards,
>> Michael
>>
>>
>> egolan74 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]
>> >>
>> >>
>> >
>> >
>> > -----
>> > 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-tp20719154p20720178.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]
>>
>>
>
>
> -----
> 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-tp20719154p20721787.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]