Package org.apache.wicket
Class DefaultExceptionMapper
- java.lang.Object
-
- org.apache.wicket.DefaultExceptionMapper
-
- All Implemented Interfaces:
IExceptionMapper
public class DefaultExceptionMapper extends Object implements 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 andapplication configuration
-
-
Constructor Summary
Constructors Constructor Description DefaultExceptionMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RenderPageRequestHandler
createPageRequestHandler(PageProvider pageProvider)
Creates aRenderPageRequestHandler
for the target page provided bypageProvider
.protected Page
extractCurrentPage()
protected IRequestHandler
handleNestedException(Exception originalException, RuntimeException nestedException)
Handles the case when an exception is generated while mapping the original exception happenedprotected boolean
isProcessingAjaxRequest()
IRequestHandler
map(Exception e)
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 Detail
-
DefaultExceptionMapper
public DefaultExceptionMapper()
-
-
Method Detail
-
map
public IRequestHandler map(Exception e)
- 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
protected IRequestHandler mapExpectedExceptions(Exception e, Application application)
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
protected IRequestHandler mapUnexpectedExceptions(Exception e, Application application)
Maps unexpected exceptions to their correspondingIRequestHandler
.- Parameters:
e
- the current exceptionapplication
- the current application object- Returns:
- the
IRequestHandler
for the current exception
-
createPageRequestHandler
protected RenderPageRequestHandler createPageRequestHandler(PageProvider pageProvider)
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
protected boolean isProcessingAjaxRequest()
- Returns:
- true if current request is an AJAX request, false otherwise.
-
extractCurrentPage
protected Page extractCurrentPage()
- Returns:
- the page being rendered when the exception was thrown, or
null
if it cannot be extracted
-
-