java.lang.Object
org.apache.wicket.DefaultExceptionMapper
- All Implemented Interfaces:
IExceptionMapper
If an exception is thrown when a page is being rendered this mapper will decide which error page
to show depending on the exception type and
application
configuration
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected RenderPageRequestHandler
createPageRequestHandler
(PageProvider pageProvider) Creates aRenderPageRequestHandler
for the target page provided bypageProvider
.protected Page
protected IRequestHandler
handleNestedException
(Exception originalException, RuntimeException nestedException) Handles the case when an exception is generated while mapping the original exception happenedprotected boolean
protected IRequestHandler
mapExpectedExceptions
(Exception e, Application application) Maps expected exceptions (i.e.protected IRequestHandler
mapUnexpectedExceptions
(Exception e, Application application) Maps unexpected exceptions to their correspondingIRequestHandler
.
-
Constructor Details
-
DefaultExceptionMapper
public DefaultExceptionMapper()
-
-
Method Details
-
map
- Specified by:
map
in interfaceIExceptionMapper
- Returns:
IRequestHandler
for given exception
-
handleNestedException
protected IRequestHandler handleNestedException(Exception originalException, RuntimeException nestedException) Handles the case when an exception is generated while mapping the original exception happened- Parameters:
originalException
- The original exception.nestedException
- The nested (second) exception produced- Returns:
- IRequestHandler (by default ErrorCodeRequestHandler
-
mapExpectedExceptions
Maps expected exceptions (i.e. those internally used by Wicket) to their correspondingIRequestHandler
.- Parameters:
e
- the current exceptionapplication
- the current application object- Returns:
- the
IRequestHandler
for the current exception
-
mapUnexpectedExceptions
Maps unexpected exceptions to their correspondingIRequestHandler
.- Parameters:
e
- the current exceptionapplication
- the current application object- Returns:
- the
IRequestHandler
for the current exception
-
createPageRequestHandler
Creates aRenderPageRequestHandler
for the target page provided bypageProvider
.Uses
RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT
policy to preserve the original page's URL for non-Ajax requests andRenderPageRequestHandler.RedirectPolicy.AUTO_REDIRECT
for AJAX requests.- Parameters:
pageProvider
- the page provider for the target page- Returns:
- the request handler for the target page
-
isProcessingAjaxRequest
- Returns:
- true if current request is an AJAX request, false otherwise.
-
extractCurrentPage
- Returns:
- the page being rendered when the exception was thrown, or
null
if it cannot be extracted
-