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
ConstructorsConstructorDescriptionPerContextHandlerRegistry
(@NotNull org.apache.felix.http.base.internal.HttpConfig config) Default http service registryPerContextHandlerRegistry
(@NotNull ServletContextHelperInfo info, @NotNull org.apache.felix.http.base.internal.HttpConfig config) Registry for a servlet context helper (whiteboard support) -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(@NotNull PerContextHandlerRegistry other) org.apache.felix.http.base.internal.HttpConfig
long
@Nullable ServletHandler
getErrorHandler
(int code, @Nullable Throwable exception) Get the servlet handling the error.@NotNull FilterHandler[]
getFilterHandlers
(@Nullable ServletHandler servletHandler, @NotNull jakarta.servlet.DispatcherType dispatcherType, @NotNull String requestURI) Get filter handlers for the request urivoid
getRuntime
(org.osgi.service.servlet.runtime.dto.ServletContextDTO dto, FailedDTOHolder failedDTOHolder) Create all DTOs for servlets, filters, resources and error pagesisMatching
(@NotNull String requestURI) void
registerFilter
(@NotNull FilterHandler handler) Add a filtervoid
registerListeners
(@NotNull ListenerHandler listenerHandler) Register listenersvoid
registerServlet
(@NotNull ServletHandler handler) Add a servletvoid
resolveServletByName
(String name) void
unregisterFilter
(@NotNull FilterInfo info, boolean destroy) Remove a filtervoid
unregisterListeners
(@NotNull ListenerInfo info) Unregister listenersvoid
unregisterServlet
(@NotNull ServletInfo servletInfo, boolean destroy) Remove a servlet
-
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 infoconfig
- The configuration
-
-
Method Details
-
getContextServiceId
public long getContextServiceId() -
getConfig
public org.apache.felix.http.base.internal.HttpConfig getConfig() -
removeAll
public void removeAll() -
compareTo
- Specified by:
compareTo
in interfaceComparable<PerContextHandlerRegistry>
-
isMatching
-
resolve
-
resolveServletByName
-
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 typerequestURI
- 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 codeexception
- The optional exception- Returns:
- The servlet handler or
null
.
-
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 DTOfailedDTOHolder
- The container for all failed DTOs
-
registerServlet
Add a servlet- Parameters:
handler
- The servlet handler
-
unregisterServlet
Remove a servlet- Parameters:
servletInfo
- The servlet infodestroy
- Destroy the servlet
-
registerFilter
Add a filter- Parameters:
handler
- The filter handler
-
unregisterFilter
Remove a filter- Parameters:
info
- The filter infodestroy
- Destroy the filter
-
registerListeners
Register listeners- Parameters:
listenerHandler
- The listener handler
-
unregisterListeners
Unregister listeners- Parameters:
info
- The listener info
-