Author: adelbene
Date: Sun Nov 2 21:51:08 2014
New Revision: 1636201
URL: http://svn.apache.org/r1636201
Log:
Added a paragrph on exception handling.
Added:
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_6.gdoc
Modified:
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_5.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/toc.yml
Modified:
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_5.gdoc
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_5.gdoc?rev=1636201&r1=1636200&r2=1636201&view=diff
==============================================================================
---
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_5.gdoc
(original)
+++
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_5.gdoc
Sun Nov 2 21:51:08 2014
@@ -1,5 +1,30 @@
+Wicket uses a number of custom exceptions during the regular running of an
application. We have already seen @PageExpiredException@ raised when a page
version is expired. Other examples of such exceptions are
@AuthorizationException@ and @RestartResponseException@. We will see them later
in the next chapters.
+All the other exceptions raised during rendering phase are handled by an
implementation of @org.apache.wicket.request.IExceptionMapper@ which by default
is class @org.wicket.DefaultExceptionMapper@. If we are working in DEVELOPMENT
mode this mapper will redirect us to a page that shows the exception stacktrace
(page @ExceptionErrorPage@). On the contrary, if application is running in
DEPLOYMENT mode @DefaultExceptionMapper@ will display an internal error page
which by default is @InternalErrorPage@.
+To use a custom internal error page we can change application settings like
this:
+{code}
+getApplicationSettings().setInternalErrorPage(MyInternalErrorPage.class);
+{code}
-In this chapter we had a look at how Wicket internally handles a web request.
Even if most of the time we won't need to customize this internal process,
knowing how it works is essential to use the framework at 100%.
+We can also manually set if Wicket should display the exception with
@ExceptionErrorPage@ or if we want to use the internal error page or if we
don't want to display anything at all when an unexpected exception is thrown:
-Entities like Application and Session will come in handy again when we will
tackle the topic of security in chapter 20.
\ No newline at end of file
+{code}
+//show default developer page
+getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
+//show internal error page
+getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
+//show no exception page when an unexpected exception is thrown
+getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_NO_EXCEPTION_PAGE);
+{code}
+
+Developers can also decide to use a custom exception mapper instead of
@DefaultExceptionMapper@. To do this we must override @Application@'s method
@getExceptionMapperProvider@:
+
+{code}
+@Override
+public IProvider<IExceptionMapper> getExceptionMapperProvider()
+{
+ //...
+}
+{code}
+
+The method returns an instance of @org.apache.wicket.util.IProvider@ that
should return our custom exception mapper.
Added:
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_6.gdoc
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_6.gdoc?rev=1636201&view=auto
==============================================================================
---
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_6.gdoc
(added)
+++
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/requestProcessing/requestProcessing_6.gdoc
Sun Nov 2 21:51:08 2014
@@ -0,0 +1,5 @@
+
+
+In this chapter we had a look at how Wicket internally handles a web request.
Even if most of the time we won't need to customize this internal process,
knowing how it works is essential to use the framework at 100%.
+
+Entities like Application and Session will come in handy again when we will
tackle the topic of security in chapter 20.
\ No newline at end of file
Modified: wicket/common/site/trunk/_site/guide/guide/src/docs/guide/toc.yml
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/guide/src/docs/guide/toc.yml?rev=1636201&r1=1636200&r2=1636201&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/guide/src/docs/guide/toc.yml (original)
+++ wicket/common/site/trunk/_site/guide/guide/src/docs/guide/toc.yml Sun Nov
2 21:51:08 2014
@@ -55,7 +55,8 @@ requestProcessing:
requestProcessing_2: Request and Response classes
requestProcessing_3: The âdirectorâ of request processing - RequestCycle
requestProcessing_4: Session Class
- requestProcessing_5: Summary
+ requestProcessing_5: Exception handling
+ requestProcessing_6: Summary
urls:
title: Wicket Links and URL generation
urls_1: PageParameters