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 intcompareTo(@NotNull PerContextHandlerRegistry other)org.apache.felix.http.base.internal.HttpConfiggetConfig()longgetContextServiceId()@Nullable ServletHandlergetErrorHandler(int code, @Nullable Throwable exception)Get the servlet handling the error.EventListenerRegistrygetEventListenerRegistry()@NotNull FilterHandler[]getFilterHandlers(@Nullable ServletHandler servletHandler, @NotNull javax.servlet.DispatcherType dispatcherType, @NotNull String requestURI)Get filter handlers for the request urivoidgetRuntime(org.osgi.service.http.runtime.dto.ServletContextDTO dto, FailedDTOHolder failedDTOHolder)Create all DTOs for servlets, filters, resources and error pagesStringisMatching(@NotNull String requestURI)voidregisterFilter(@NotNull FilterHandler handler)Add a filtervoidregisterListeners(@NotNull ListenerHandler listenerHandler)Register listenersvoidregisterServlet(@NotNull ServletHandler handler)Add a servletvoidremoveAll()PathResolutionresolve(@NotNull String relativeRequestURI)ServletHandlerresolveServletByName(String name)voidunregisterFilter(@NotNull FilterInfo info, boolean destroy)Remove a filtervoidunregisterListeners(@NotNull ListenerInfo info)Unregister listenersvoidunregisterServlet(@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:
compareToin 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
-
-