Package com.oorian

Class DefaultErrorPage

Direct Known Subclasses:
DefaultForbiddenPage, DefaultNotFoundPage, DefaultServerErrorPage

public class DefaultErrorPage extends ErrorPage
Built-in error page that renders a clean, professional error page for any HTTP status code.

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 Details

    • DefaultErrorPage

      public DefaultErrorPage()
      Creates a new DefaultErrorPage instance.
  • Method Details

    • createBody

      protected void createBody(Body body)
      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(), and ErrorPage.getMessage() to access error details.

      Specified by:
      createBody in class ErrorPage
      Parameters:
      body - the Body element to add content to
    • createHead

      protected void createHead(Head head)
      Hook for subclasses to add additional elements to the <head>.

      Override this method to add custom Style elements, 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:
      createHead in class ErrorPage
      Parameters:
      head - the Head element to add content to