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

# Class PerContextHandlerRegistry

java.lang.Object
org.apache.felix.http.base.internal.registry.PerContextHandlerRegistry

All Implemented Interfaces:
  `Comparable<PerContextHandlerRegistry>`

public final class PerContextHandlerRegistry extends Object implements Comparable<PerContextHandlerRegistry>
This registry keeps track of all processing components per context: - servlets - filters - error pages

## Constructor Summary

Constructors
Constructor
Description
`PerContextHandlerRegistry(@NotNull org.apache.felix.http.base.internal.HttpConfig config)`
Default http service registry
`PerContextHandlerRegistry(@NotNull ServletContextHelperInfo info, @NotNull org.apache.felix.http.base.internal.HttpConfig config)`
Registry for a servlet context helper (whiteboard support)

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(@NotNull PerContextHandlerRegistry other)`
`org.apache.felix.http.base.internal.HttpConfig`
`getConfig()`
`long`
`getContextServiceId()`
`@Nullable ServletHandler`
`getErrorHandler(int code, @Nullable Throwable exception)`
Get the servlet handling the error.
`EventListenerRegistry`
`getEventListenerRegistry()`
`@NotNull FilterHandler[]`
`getFilterHandlers(@Nullable ServletHandler servletHandler, @NotNull jakarta.servlet.DispatcherType dispatcherType, @NotNull String requestURI)`
Get filter handlers for the request uri
`void`
`getRuntime(org.osgi.service.servlet.runtime.dto.ServletContextDTO dto, FailedDTOHolder failedDTOHolder)`
Create all DTOs for servlets, filters, resources and error pages
`String`
`isMatching(@NotNull String requestURI)`
`void`
`registerFilter(@NotNull FilterHandler handler)`
Add a filter
`void`
`registerListeners(@NotNull ListenerHandler listenerHandler)`
Register listeners
`void`
`registerServlet(@NotNull ServletHandler handler)`
Add a servlet
`void`
`removeAll()`
`PathResolution`
`resolve(@NotNull String relativeRequestURI)`
`ServletHandler`
`resolveServletByName(String name)`
`void`
`unregisterFilter(@NotNull FilterInfo info, boolean destroy)`
Remove a filter
`void`
`unregisterListeners(@NotNull ListenerInfo info)`
Unregister listeners
`void`
`unregisterServlet(@NotNull ServletInfo servletInfo, boolean destroy)`
Remove a servlet

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

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

## Constructor Details

### PerContextHandlerRegistry

public PerContextHandlerRegistry(@NotNull @NotNull org.apache.felix.http.base.internal.HttpConfig config)
Default http service registry

Parameters:
  `config` - The configuration

### PerContextHandlerRegistry

public PerContextHandlerRegistry(@NotNull @NotNull ServletContextHelperInfo info, @NotNull @NotNull org.apache.felix.http.base.internal.HttpConfig config)
Registry for a servlet context helper (whiteboard support)

Parameters:
  `info` - The servlet context helper info
  `config` - The configuration

## Method Details

### getContextServiceId

public long getContextServiceId()

### getConfig

public org.apache.felix.http.base.internal.HttpConfig getConfig()

### removeAll

public void removeAll()

### compareTo

public int compareTo(@NotNull @NotNull PerContextHandlerRegistry other)

Specified by:
  `compareTo` in interface `Comparable<PerContextHandlerRegistry>`

### isMatching

public String isMatching(@NotNull @NotNull String requestURI)

### resolve

public PathResolution resolve(@NotNull @NotNull String relativeRequestURI)

### resolveServletByName

public ServletHandler resolveServletByName(String name)

### getFilterHandlers

@NotNull public @NotNull FilterHandler[] getFilterHandlers(@Nullable @Nullable ServletHandler servletHandler, @NotNull @NotNull jakarta.servlet.DispatcherType dispatcherType, @NotNull @NotNull String requestURI)
Get filter handlers for the request uri

Parameters:
  `servletHandler` - The servlet handler (might be null)
  `dispatcherType` - The dispatcher type
  `requestURI` - The request uri
Returns:
  The array of filter handlers, the array might be empty.

### getErrorHandler

@Nullable public @Nullable ServletHandler getErrorHandler(int code, @Nullable @Nullable Throwable exception)
Get the servlet handling the error.

Parameters:
  `code` - The error code
  `exception` - The optional exception
Returns:
  The servlet handler or `null`.

### getEventListenerRegistry

public EventListenerRegistry getEventListenerRegistry()

### getRuntime

public void getRuntime(org.osgi.service.servlet.runtime.dto.ServletContextDTO dto, FailedDTOHolder failedDTOHolder)
Create all DTOs for servlets, filters, resources and error pages

Parameters:
  `dto` - The servlet context DTO
  `failedDTOHolder` - The container for all failed DTOs

### registerServlet

public void registerServlet(@NotNull @NotNull ServletHandler handler)
Add a servlet

Parameters:
  `handler` - The servlet handler

### unregisterServlet

public void unregisterServlet(@NotNull @NotNull ServletInfo servletInfo, boolean destroy)
Remove a servlet

Parameters:
  `servletInfo` - The servlet info
  `destroy` - Destroy the servlet

### registerFilter

public void registerFilter(@NotNull @NotNull FilterHandler handler)
Add a filter

Parameters:
  `handler` - The filter handler

### unregisterFilter

public void unregisterFilter(@NotNull @NotNull FilterInfo info, boolean destroy)
Remove a filter

Parameters:
  `info` - The filter info
  `destroy` - Destroy the filter

### registerListeners

public void registerListeners(@NotNull @NotNull ListenerHandler listenerHandler)
Register listeners

Parameters:
  `listenerHandler` - The listener handler

### unregisterListeners

public void unregisterListeners(@NotNull @NotNull ListenerInfo info)
Unregister listeners

Parameters:
  `info` - The listener info