Class ErrorPageRegistry


  • public final class ErrorPageRegistry
    extends Object
    The error page registry keeps tracks of the active/inactive servlets handling error pages (error code and/or exception). This registry is per servlet context.
    • Constructor Detail

      • ErrorPageRegistry

        public ErrorPageRegistry()
    • Method Detail

      • getErrorRegistration

        @Nullable
        public static @Nullable ErrorPageRegistry.ErrorRegistration getErrorRegistration​(@NotNull
                                                                                         @NotNull ServletInfo info)
        Parse the registration properties of the servlet for error handling
        Parameters:
        info - The servlet info
        Returns:
        An error registration object if the servlet handles errors
      • addServlet

        public void addServlet​(@NotNull
                               @NotNull ServletHandler handler)
        Add the servlet for error handling
        Parameters:
        handler - The servlet handler.
      • removeServlet

        public void removeServlet​(@NotNull
                                  @NotNull ServletInfo info,
                                  boolean destroy)
        Remove the servlet from error handling
        Parameters:
        info - The servlet info.
      • cleanup

        public void cleanup()
      • get

        public ServletHandler get​(Throwable exception,
                                  int errorCode)
        Get the servlet handling the error (error code or exception). If an exception is provided, a handler for the exception is searched first. If no handler is found (or no exception provided) a handler for the error code is searched.
        Parameters:
        exception - Optional exception
        errorCode - Error code
        Returns:
        The servlet handling the error or null
      • getRuntimeInfo

        public void getRuntimeInfo​(org.osgi.service.http.runtime.dto.ServletContextDTO dto,
                                   Collection<org.osgi.service.http.runtime.dto.FailedErrorPageDTO> failedErrorPageDTOs)
        Get DTOs for error pages.
        Parameters:
        dto - The servlet context DTO
        failedErrorPageDTOs - The failed error page DTOs