Class DefaultErrorPage
- Direct Known Subclasses:
DefaultForbiddenPage,DefaultNotFoundPage,DefaultServerErrorPage
This page extends ErrorPage and builds its content using Oorian's element-based
API. It provides a professional, responsive error display with status code, title, message,
and a "Return to Home" link.
The framework automatically uses this page as a fallback when no custom error page is
registered via Application.setErrorPage(int, Class) or
Application.setDefaultErrorPage(Class).
When ApplicationDefaults.isDevMode() is true, additional diagnostic
details are shown including the request path, exception class, message, and full stack
trace.
Usage:
// Use as a catch-all error page
setDefaultErrorPage(DefaultErrorPage.class);
// Or register for specific status codes
setErrorPage(404, DefaultErrorPage.class);
setErrorPage(500, DefaultErrorPage.class);
For status-code-specific subclasses, see DefaultNotFoundPage,
DefaultServerErrorPage, and DefaultForbiddenPage.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateBody(Body body) Builds the error page body content using Oorian elements.protected voidcreateHead(Head head) Hook for subclasses to add additional elements to the<head>.Methods inherited from class com.oorian.ErrorPage
createFile, escapeHtml, getException, getMessage, getMessage, getRequestPath, getStatusCode, getTitle, getTitle, initializeFile, toStringMethods inherited from class com.oorian.HttpFile
addResponseHeader, create, getCacheControl, getDocumentUrl, getFullUrl, getHost, getHttpRequest, getOriginalParameters, getParameter, getParameterAsFloat, getParameterAsInt, getParameterAsLong, getParameterAsShort, getParameters, getParametersAFloat, getParametersAsInt, getParametersAsLong, getParametersAsShort, getParameterValues, getPath, getServletPath, getSessionId, getUrl, getUrlParameters, getWebResponse, hasParameter, hasUrlParams, isWritten, onCreated, onWriteComplete, setCacheControl, setCharacterEncoding, setContentType, setResponseHeader, setUrlParameters, toString, toString, write
-
Constructor Details
-
DefaultErrorPage
public DefaultErrorPage()Creates a new DefaultErrorPage instance.
-
-
Method Details
-
createBody
Builds the error page body content using Oorian elements.Subclasses implement this method to populate the body with elements such as H1, Paragraph, Div, etc.
Use the convenience getters
ErrorPage.getStatusCode(),ErrorPage.getRequestPath(),ErrorPage.getException(),ErrorPage.getTitle(), andErrorPage.getMessage()to access error details.- Specified by:
createBodyin classErrorPage- Parameters:
body- the Body element to add content to
-
createHead
Hook for subclasses to add additional elements to the<head>.Override this method to add custom
Styleelements, meta tags, or other head content. The base implementation does nothing. The head already contains charset, viewport, title, and base CSS reset styles when this method is called.- Overrides:
createHeadin classErrorPage- Parameters:
head- the Head element to add content to
-