Package org.apache.felix.http.base.internal.registry

# Class ErrorPageRegistry

java.lang.Object
org.apache.felix.http.base.internal.registry.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.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`ErrorPageRegistry.ErrorRegistration`

## Constructor Summary

Constructors
Constructor
Description
`ErrorPageRegistry()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addServlet(@NotNull ServletHandler handler)`
Add the servlet for error handling
`void`
`cleanup()`
`ServletHandler`
`get(Throwable exception, int errorCode)`
Get the servlet handling the error (error code or exception).
`static @Nullable ErrorPageRegistry.ErrorRegistration`
`getErrorRegistration(@NotNull ServletInfo info)`
Parse the registration properties of the servlet for error handling
`void`
`getRuntimeInfo(org.osgi.service.servlet.runtime.dto.ServletContextDTO dto, Collection<org.osgi.service.servlet.runtime.dto.FailedErrorPageDTO> failedErrorPageDTOs)`
Get DTOs for error pages.
`void`
`removeServlet(@NotNull ServletInfo info, boolean destroy)`
Remove the servlet from error handling

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ErrorPageRegistry

public ErrorPageRegistry()

## Method Details

### 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.
  `destroy` - Unused

### 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.servlet.runtime.dto.ServletContextDTO dto, Collection<org.osgi.service.servlet.runtime.dto.FailedErrorPageDTO> failedErrorPageDTOs)
Get DTOs for error pages.

Parameters:
  `dto` - The servlet context DTO
  `failedErrorPageDTOs` - The failed error page DTOs