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 registryPerContextHandlerRegistry(@NotNull ServletContextHelperInfo info, @NotNull org.apache.felix.http.base.internal.HttpConfig config)
Registry for a servlet context helper (whiteboard support)
-
Method Summary
All Methods Instance Methods Concrete Methods 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 javax.servlet.DispatcherType dispatcherType, @NotNull String requestURI)
Get filter handlers for the request urivoid
getRuntime(org.osgi.service.http.runtime.dto.ServletContextDTO dto, FailedDTOHolder failedDTOHolder)
Create all DTOs for servlets, filters, resources and error pagesString
isMatching(@NotNull String requestURI)
void
registerFilter(@NotNull FilterHandler handler)
Add a filtervoid
registerListeners(@NotNull ListenerHandler listenerHandler)
Register listenersvoid
registerServlet(@NotNull ServletHandler handler)
Add a servletvoid
removeAll()
PathResolution
resolve(@NotNull String relativeRequestURI)
ServletHandler
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 Detail
-
PerContextHandlerRegistry
public PerContextHandlerRegistry(@NotNull @NotNull org.apache.felix.http.base.internal.HttpConfig config)
Default http service registry
-
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
-
-
Method Detail
-
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 interfaceComparable<PerContextHandlerRegistry>
-
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 javax.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
public EventListenerRegistry getEventListenerRegistry()
-
getRuntime
public void getRuntime(org.osgi.service.http.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
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 infodestroy
- 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 infodestroy
- Destroy the filter
-
registerListeners
public void registerListeners(@NotNull @NotNull ListenerHandler listenerHandler)
Register listeners- Parameters:
listenerHandler
-
-
unregisterListeners
public void unregisterListeners(@NotNull @NotNull ListenerInfo info)
Unregister listeners- Parameters:
info
- The listener info
-
-