|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ServletModuleManager
The ServletModuleManager is responsible for servlets and filters - and their servlet contexts - defined in plugins.
It is used by instances of the ServletModuleContainerServlet
and ServletFilterModuleContainerFilter
to lookup, create and wrap the filters and servlets defined in plugins.
Filter
or Servlet
is first accessed in a plugin, a new ServletContext
is
created for all the modules in the plugin to share. This is done by wrapping the applications
ServletContext
, creating a map of attributes that are local to the plugin that are shadowed by the
applications ServletContext
attributes, merging any servlet context init parameters from the plugin and the
application, and then running through any ServletContextListener
s defined by the plugin has calling their
contextInitialized() methods.
The shadowing of the the plugins ServletContext
s attributes are shadowed by the applications attributes
means that if an attribute does not exist in the plugin local attribute map, the applications attributes will be
returned. The plugin is thereby prevented from modifying the base applications context attributes on an application
wide scope and can instead only change them, but not remove them, on a local scope.
The init parameters in the plugin will override parameters from the base applications servlet
init parameters that have the same name.
During the creation of Filters and Servlets, the FilterConfig
and ServletConfig
provided to
Filters and Servlets contain the plugin local ServletContext
, as described above,
and provides access to the init parameters defined in the plugin xml for the Filter or Servlet.
After being created, the filters and servlets are wrapped to ensure the the init(), service(), doFilter(),
and destroy() methods and other methods defined in the Filter and Servlet interfaces are executed in the plugins
ClassLoader
.
The plugins ServletContext
is not destroyed until the plugin is disabled. It is also at this time that any
ServletContextListener
s will have their contextDestroyed() methods called.
Method Summary | |
---|---|
void |
addFilterModule(ServletFilterModuleDescriptor descriptor)
Register a new filter plugin module. |
void |
addServletModule(ServletModuleDescriptor descriptor)
Register a new servlet plugin module. |
java.lang.Iterable<javax.servlet.Filter> |
getFilters(FilterLocation location,
java.lang.String pathInfo,
javax.servlet.FilterConfig filterConfig)
Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack. |
javax.servlet.http.HttpServlet |
getServlet(java.lang.String path,
javax.servlet.ServletConfig servletConfig)
Return an instance of the HttpServlet that should be used to serve content matching the provided url path. |
void |
removeFilterModule(ServletFilterModuleDescriptor descriptor)
Remove a previously registered filter plugin module. |
void |
removeServletModule(ServletModuleDescriptor descriptor)
Remove a previously registered servlet plugin module. |
Method Detail |
---|
void addServletModule(ServletModuleDescriptor descriptor)
descriptor
- Details of what the servlet class is and the path it should serve.javax.servlet.http.HttpServlet getServlet(java.lang.String path, javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
path
- Path of the incoming request to serve.servletConfig
- ServletConfig given to the delegating servlet.
javax.servlet.ServletException
- Thrown if there is a problem initializing the servlet to be returned.void removeServletModule(ServletModuleDescriptor descriptor)
descriptor
- Details of what servlet module to remove.void addFilterModule(ServletFilterModuleDescriptor descriptor)
descriptor
- Details of what the filter class is and the path it should serve.java.lang.Iterable<javax.servlet.Filter> getFilters(FilterLocation location, java.lang.String pathInfo, javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
location
- Place in the applications filter stack the filters should be applied.pathInfo
- Path of the incoming request to filter.filterConfig
- FilterConfig given to the delegating filter.
javax.servlet.ServletException
- Thrown if there is a problem initializing one of the filters to apply.void removeFilterModule(ServletFilterModuleDescriptor descriptor)
descriptor
- Details of what filter module to remove.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |